-
Notifications
You must be signed in to change notification settings - Fork 533
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
Compilation times of record operations could be improved #50
Comments
See also #102. |
Is there any other update on this issue? My code uses Witnesses of Symbols as keys. |
At the moment I'm afraid not ... this is going to need a Scala compiler fix to eliminate the pathological behaviour for String singleton types. My current plan is to investigate this in typelevel/scala#41 and if successful feed a patch back to scala/scala. |
Thanks for the immediate feedback, Miles |
I'm afraid that constant type stringification isn't the true pathology here. It's easy enough to speed it up (scala/scala@2.11.x...retronym:ticket/perf-constant-type-string), but it doesn't make an appreciable different to this benchmark. Similarly, avoiding more needless anonymous subsclass of I believe that the quadratic factor comes from the implicit search for a One solution here would be to "intrinsify" this operation into a single implicit macro that internalized the recursion over the hlist type. As a starting point, here is a method that determines the index of a tag within the hlist type. It is just a POC, a real implementation should be more robust against unexpected types.
|
Thanks for the analysis @retronym. I'll pursue something along these lines in shapeless 3.0. |
@milessabin any chance this can get addresses for 2.2.x? Any more complex patterns are making compile times to explode :-( |
@pchlupacek are you able to test @retronym's suggested |
@milessabin will do (need to understand it first). In fact I think there is something really weird going on. I have feelings that compilation times gets longer and longer for the same code within sbt. At least I can prove that fresh sbt build takes much less (~1/3) of compilation time after using the sbt for the while. |
Fixed along the lines suggested by @retronym. |
@milessabin excellent thanks. Will test it agains this fix and let you know. |
We have a deep nested structure to parse from case classes to shapeless records which is very slow, takes almost 20 minutes to compile. Any suggestion how that can be improved? |
As a simple performance test consider a class below. Uncomment line by line and measure the build time.
Times on my machine with current Shapeless.
Using Witnesses is more expensive than objects as keys.
Times on my machine with current Shapeless.
Switching to
improves compilation times.
Getting beyond that is perhaps not possible in Shapeless and further optimizations should be done in scalac?
The text was updated successfully, but these errors were encountered: