-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Use inline val
for inlined final val
s
#13989
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
Use inline val
for inlined final val
s
#13989
Conversation
inline val
for inlined final val
sinline val
for inlined final val
s
These `val`s are already inlined and do not generate a field, but they still generate a getter that is never used. My marking these as `inline` we can remove the getter and save a few bytes at runtime. By making these fields `inline` we can also check that the RHS constant folds to a value at compile time.
9874d9a
to
eba5290
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.
but they still generate a getter that is never used
Is that getter public? If so that sounds like a binary-breaking change so not something we could do in scala 3.
Those are only in the compiler. Not in the library. |
test performance please |
Test performance please |
@anatoliykmetyuk the benchmarking machine is not responding. |
test performance please |
performance test scheduled: 1 job(s) in queue, 0 running. |
Performance test finished successfully: Visit https://dotty-bench.epfl.ch/13989/ to see the changes. Benchmarks is based on merging with master (ca483f8) |
These
val
s are already inlined and do not generate a field, but theystill generate a getter that is never used. My marking these as
inline
we can remove the getter and save a few bytes at runtime.
By making these fields
inline
we can also check that the RHS constantfolds to a value at compile time.