As of this moment, the performance win on new-metrics.rkt for
using the unsafe version is about 1% (avg over 10 runs), which
isn't enough to make it worth the segfaults. I believe that
changes to the JIT since 2012 (when the unsafe ops were added)
have sped up struct access.
The `local-expand` based trick defeats optimizations for the
contract system because of the extra `let-values` that's
introduced, so use `syntax-local-lift-require` instead.
This commit combined with the previous commit improves
the performance of the test at
typed-racket-test/performance/function-contract.
by a significant amount back to v6.1.1 performance.
Thanks to Robby for discovering the regression.
The contract generation process was aggressively optimizing
some contracts, leading to a pessimization when interacting
with the contract system's own optimizations.
This inlining addition undoes a small portion of the contract
generation in some cases to better cooperate with the contract
system's optimizations.
This commit alone doesn't solve the optimization problem.
But it does when combined with the next commit.
For private `define-values` in classes with multiple variables, don't
eagerly throw type errors in the synthesis step. Instead, wait
until the later checking step when the environment will be correctly
set up.
When the initial synthesis typecheck fails, yield type Any for
the environment. If the typecheck should really fail, this is ok. If
not, then the user can add a type annotation.
A better long-term strategy is to change the handling of environments
so that the type environment gets refined as definitions are checked.
This way all annotations that the user writes are factored into the
initial environment and unannotated variables will have their types
synthesized.
...that also involve contracts.
That code was previously not marked as lifted by the contract system, and
thus was not ignored by TR. But TR was not giving it a type, which made the
optimizer unhappy, now that it looks at the types of everything.
Most unit forms are supported, including most of the "infer" forms that
infer imports/exports/linkages from the current context.
Notably, none of the structural linking forms for units are supported, and
`define-unit-binding` is also currently unsupported.