-
Notifications
You must be signed in to change notification settings - Fork 1
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
Stop tuple adaptation earlier #64
base: 2.12.x
Are you sure you want to change the base?
Conversation
This means less for the compiler: ``` class C(x: Boolean) { def this() = this(false) } class Test { new C() } ``` Before, this incurs an implicit search from `Unit => Boolean`. This change breaks (at least one test: /Users/jz/code/scala-2.12.x/test/files/neg/t8035-no-adapted-args.scala
/cc @hrhino @mkeskells |
Previous work in this area: |
Here's a contrived benchmark: class C(x: Boolean) {
def this() = this(false)
}
class Test {
new C
new C
new C
new C
new C
new C
// etc, etc
} Before:
After:
|
That seems a decent win, for the micro-benchmark at least So do I read this correctly? - this would save approx. 6ms for each occurrence in source code, and probably some allocation reduction in some cases as well (91-54)/6. Please confirm this reading Are any of the standard benchmarks (scalac, better-files etc) relying on If you can compile scalac with What is the lightbend view on this? Is this a think that we have to put in a separate flag for avoid breaks |
I presume that the saving would vary depending on the number of implicits in scope, and there is a search for |
I had 4608 |
Haha it did sound too good to be true as an absolute value still 9 us is a good tick. |
This means less for the compiler:
Before, this incurs an implicit search from
Unit => Boolean
.This change breaks (at least) this test:
/Users/jz/code/scala-2.12.x/test/files/neg/t8035-no-adapted-args.scala