-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Optimizations: Make code inlining friendlier #3265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
test performance please |
performance test scheduled: 11 job(s) in queue, 1 running. |
cf70732
to
9a7ea3c
Compare
test performance please |
performance test scheduled: 6 job(s) in queue, 1 running. |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/3265/ to see the changes. Benchmarks is based on merging with master (af528a1) |
test performance please |
performance test scheduled: 21 job(s) in queue, 1 running. |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/3265/ to see the changes. Benchmarks is based on merging with master (2ecd3d2) |
Making completion printing a config option keeps the size of key method `SymDenotations#completeFrom` small.
This is useful for keeping code small.
- Enable only if global config option is true (this avoids clutter in traced methods). - Move out of context into separate object `reporting.trace`. - Avoid default arguments, since these are loaded before inlining. The net effect of these methods is no parts of tracing calls remain in generated code if config.tracingEnabled is false.
In particular, this test the changes to constant folding done two commits ago.
f3e0a15
to
745fa3d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I added some bytecode tests to check the constant folding actually works.
case y :: Nil if y.tpe.widen.isRef(defn.BooleanClass) => | ||
op match { | ||
case nme.ZAND => if (c) y else x | ||
case nme.ZOR => if (c) x else y |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably doesn't matter in this case, but I prefer to check the symbol's name (or identity), rather than the selected name, so as to avoid mis-classification in the presence of renaming imports.
I noted that despite inlining and the printer scheme key operations had a lot of junk in them. This PR tries to address that, so that we remove unnecessary debug code from hot operations.
First, making completion printing a config option keeps the size of
key method
SymDenotations#completeFrom
small. (completeFrom showed up as taking alomst 1% in the no HT profile)Second, we also make all tracing operations conditional on a Config option.
Third, we massage tracing operations themselves and tweak inlining so that no trace of the tracing operation remains in the generated code.