-
Notifications
You must be signed in to change notification settings - Fork 80
Could performance of wiring be improved? #136
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
Comments
Interesting, thanks for the info! I don't think anybody ever looked at optimizing the code - if you would have any data on what specifically takes so long, that could be helpful. |
Okay, I've gotten past my profiing problems.
Here's what I came out with:
https://drive.google.com/drive/folders/1T5cWwKljhDuoyqmvovdb3CllCz1Dfkrm?usp=sharing That still shows that most of the time is spent in one-off costs of classloading and linking the macro implementation. Maybe because the implementation is quite lambda heavy, macwire pays a bigger cost than other macros? We're slowly getting towards a situation where macros classloaders could be reused in later compilation runs. |
This could be changed to use |
If i'm reading things correctly, I think the problem is that for each call to the In
Maybe explicit type ascriptions on the members avoid that typechecking? |
Hm if the typechecks aren't cached (by the compiler) that might indeed be n^2. There's always the option of introducing a magnolia-style global cache which would remember previous type check results? |
I'm adding compilation time tracing to
scalac
to show how long each file/class/method takes to typecheck. The trace drills down further to measure time spent in implicit searches and in macro expansions.I generated traces for a relatively large Scala build: https://github.com/guardian/frontend. This project uses MacWire for DI within a Play application.
The generated report suggests that 4% of total compilation time is spent in the
wire
macro:I'm having trouble getting a good look at this through Flight Recorder to make concrete suggestions about what could be optimized, but I thought I'd lodge this ticket as-is in the meantime.
The text was updated successfully, but these errors were encountered: