-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Tweak performance of findRef #9870
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: 6 job(s) in queue, 1 running. |
sym.is(ExtensionMethod) && (sym.extensionParam.span == xmethod.extensionParam.span) | ||
if !xmethod.exists || result.tpe.isError || canAccessUnqualified(result.symbol) then | ||
result | ||
if xmethod.exists then |
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.
I would have thought that the code here would be executed only rarely.
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.
For a simple program (see below), the speedup is about 24% (34ms/op VS 45ms/op):
class MyInt(val x: Int) {
def eq(that: MyInt): Boolean = this.x == that.x
}
class Test {
def foo(x: MyInt, y: MyInt): Boolean = x.eq(y)
val a = MyInt(2)
val b = MyInt(3)
foo(a, b)
}
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.
Interesting. I just found out why: The code in question (including the expensive tryEither) is executed twice, once for each MyInt(...). I had not thought of that. So, yes, because of constructor syntax, failures in findRef are now not that uncommon. So this is a definite improvement. Unfortunately, the benchmarks are too noisy to see this immediately.
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/9870/ to see the changes. Benchmarks is based on merging with master (246fc89) |
retest performance please |
performance test scheduled: 3 job(s) in queue, 1 running. |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/9870-1/ to see the changes. Benchmarks is based on merging with master (2ec7a6f) |
retest performance please |
performance test scheduled: 1 job(s) in queue, 0 running. |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/9870-2/ to see the changes. Benchmarks is based on merging with master (f4528ce) |
Tweak performance of findRef