Skip to content

Version 1.3.11 - #1664

Merged
sinclairzx81 merged 4 commits into
mainfrom
memory
Aug 6, 2026
Merged

Version 1.3.11#1664
sinclairzx81 merged 4 commits into
mainfrom
memory

Conversation

@sinclairzx81

Copy link
Copy Markdown
Owner

This PR implements optimizations for System.Memory.Clone and System.Memory.Discard to improve type initialization.

Updates

The optimizations were as follows:

  • Use Object.getOwnPropertyNames(...) to Enumerate Keys
  • Call Object.getOwnPropertyDescriptor(...) on Per Enumerated Key
  • Check IsEnumerable on Descriptor before assignment.
  • Use Object.defineProperty(...) if NonEnumerable
  • Use Record[Key] = X if Enumerable

The primary performance boost comes from record[key] = value assignment over defineProperty, and the per key getOwnPropertyDescriptor(...) call.

Benchmarks

Updates were tested against the TB turing benchmark. Performance shows approx 3-4x throughput performance for the "time to complete" test.

turing: 14492ms  # before
turing: 3915ms   # after

Before

Program {
  gc: {
    rss: "186.47 MB",
    heapTotal: "88.08 MB",
    heapUsed: "31.56 MB",
    external: "1.12 MB",
    arrayBuffers: "0.00 MB"
  },
  tb: {
    assign: 11624,
    create: 746063,
    clone: 96587,
    discard: 86376,
    update: 10211
  }
}
// turing: 14492ms 

After

Program {
  gc: {
    rss: "185.29 MB",
    heapTotal: "86.08 MB",
    heapUsed: "49.36 MB",
    external: "1.12 MB",
    arrayBuffers: "0.00 MB"
  },
  tb: {
    assign: 11624,
    create: 746063,
    clone: 10211,
    discard: 86376,
    update: 10211
  },
}
// turing: 3915ms

@sinclairzx81
sinclairzx81 merged commit e630565 into main Aug 6, 2026
6 checks passed
@sinclairzx81
sinclairzx81 deleted the memory branch August 6, 2026 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant