perf: reduce runtime overhead and memory usage - #79
Merged
Merged
Conversation
Reduce allocation and dispatch overhead in runtime and code metadata, JIT execution, collections, numeric operations, pickle, and datetime. Add regression coverage and retain compact benchmark reports and samples. Keep repeated source snapshots, caches, and bulk profiles in local archives. This is an ongoing-work checkpoint. The latest weakref comparison remains provisional, and allocation profiles, startup controls, and a fresh full census are still pending. CPython continues to lead many metrics. Validation: workspace formatting and all-target/all-feature Clippy pass; 729 workspace tests pass; documentation tests pass with one ignored case. The 275 configured compatibility checks, 42 focused release checks, and 114 performance-fixture checks also pass. Preserve the initial sandboxed socket-test failure alongside the successful full outside-sandbox run.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR reduces runtime allocation, copying, and dispatch overhead across JSON, strings, collections, datetime, serialization, and native/JIT calls. It also adds regression coverage and keeps generated research artifacts out of the source tree.
Changes
ObjectandDictKeyfrom 24 to 16 bytes on ARM64 through shared value storage. Use lazy instance metadata, compact slots, shared slot names, and reusable collector scratch space.Measured improvements
These are recorded macOS ARM64 measurements against each change's own predecessor, not a fresh comparison of the final PR against
main. Results from different stages must not be multiplied into a cumulative speedup.time.isoformatThe initial JSON pass reduced the 23-workload suite's geometric-mean workload time by 6%. The subsequent deque/datetime pass reduced JIT workload time by another 5.3% against its immediate predecessor. The JSON report, deque/datetime report, and runtime report document methods, tradeoffs, and reproduction commands.
Limits: WeavePy does not yet outperform CPython across all workloads or metrics. Some short allocations, calls, fallback paths, and startup measurements regressed. The final scratch-capacity limit has no qualified timing samples. Later archived JIT/datetime experiments are not part of the active implementation and their gains are not claimed here.
Validation
9a10bae5, including platform tests, bundled and free-threaded regressions, distribution checks, benchmark gates, and all nine ecosystem shards.Generated benchmark evidence remains available locally and in checkpoint history. Required Unicode/codec data, vendored build inputs, CI baselines, reusable tools, and regression fixtures remain tracked.