Repository navigation
Conversation
…deserialization Scalars skip the Expression deserialization that always failed and built a large error per call, and contract evaluation normalizes each type string once per request. Adds contracts_cpu_ms to compile timings and a same-runner python vs native-preview gate on it.
kvlonge
enabled auto-merge
October 9, 2026 15:24
Contributor
Author
|
Landed together in #1075 to cut merge-queue CI runs; review history stays here. |
github-merge-queue
Bot
removed this pull request from the merge queue due to a manual request
Oct 9, 2026
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.
Why
Under
native-preview, native model contract evaluation took ~15.7 s CPU on the dense 3,000-model project, against ~0.2 s for the Python engine (the same on main). That made the whole preview compile ~2.4× slower and blocks promoting the lane.Changes
type_system/_helpers/parsed.rs:is_python_expressionreturns false for scalars before trying to deserialize them asExpression. EveryExpressionvariant carries data, so a scalar can never deserialize. The failing deserialization built a large error message each time, costing ~100 µs pernormalize_typecall; now ~5 µs.contracts: a request-scopedTypeComparernormalizes each type string once, as Python'slru_cacheonnormalize_typedoes. No global state.compile_timingsgainscontracts_cpu_ms(CPU time of the calling thread).--base-engine/--head-engineand--gate-phase(gate one reported phase, plus--phase-noise-floor-ms). A new matrix entry in the ratio job gates native-previewcontracts_cpu_msat ≤1.00× python + 50 ms on dense 3,000 models.test_compile_json_behaviortiming keys includecontracts_cpu_ms.Verification
test_compile_json_behavior.make check-ci,make test(11938 passed), hygiene.