-
Notifications
You must be signed in to change notification settings - Fork 14
Add some precompiles and improve inference #4
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
Codecov Report
@@ Coverage Diff @@
## master #4 +/- ##
==========================================
- Coverage 87.22% 85.69% -1.53%
==========================================
Files 9 10 +1
Lines 939 972 +33
==========================================
+ Hits 819 833 +14
- Misses 120 139 +19
Continue to review full report at Codecov.
|
|
|
||
| on(computedbboxobservable(gl)) do cbb | ||
| # 0.7s inference time for this anonymous function. TODO? precompile | ||
| align_to_bbox!(gl, cbb) |
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.
@timholy That is crazy, why would such a small function take so long to infer?
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.
It's probably really the inference time for laign_to_bbox! itself. If inference was good throughout, it would be precompiled when GridLayout(Int, Int) gets precompiled. So I marked this rather than fixing it manually. I'll take a poke at Cthulhu.descend(GridLayout, (Int, Int)) and see if I can just fix the inference problem.
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.
Correction: it's due to the fact that on doesn't force specialization of its first argument. That's fine and how it should be.
I just pushed a couple more precompiles.
src/precompile.jl
Outdated
| @@ -0,0 +1,4 @@ | |||
| function _precompile_() | |||
| ccall(:jl_generating_output, Cint, ()) == 1 || return nothing | |||
| precompile(GridLayout, (Int, Int)) | |||
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.
Is precompile(GridLayout, (Int, Int)) the only thing you thought was worth doing, or would it make sense to precompile all functionality that the tests go over?
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.
Nah, just a conversation-starter 😄.
This adds a number of other precompiles too
This is a breaking change, but it makes other stuff easier. Alternately, one could force-specialize on the type (which would not be breaking). But this is generally the recommended style.
|
OK, I think this is to a good stopping point (I'm stopping, anyway). There is still more inference you could get rid of (probably mostly better A few explanations are in order:
It's also worth emphasizing that this contains a breaking change: see the modification to the LayoutObservables constructor. You can alterately use Given my other duties, this is probably the last Makie-related package that I'll directly work on for a while. But if you guys want to make further progress I am happy to answer questions. Worth emphasizing that you want to do all this work on Julia 1.6 since the invalidation picture is so much better---you'll get murky results on 1.5 because all your improvements will be invalidated. |
|
|
||
| [deps] | ||
| GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326" | ||
| InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240" |
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'm guessing, that this was unintentional?
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.
No, I used subtypes in precompile.jl.
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.
Oh :D fair enough ;)
|
Anything blocking this from being merged? It does contain a breaking change (see above), but |
Codecov Report
@@ Coverage Diff @@
## master #4 +/- ##
==========================================
- Coverage 87.22% 85.39% -1.83%
==========================================
Files 9 10 +1
Lines 939 993 +54
==========================================
+ Hits 819 848 +29
- Misses 120 145 +25
Continue to review full report at Codecov.
|
|
thank you again for your effort Tim, I just didn't have the time to go over everything until now. I can't say that I grasp all changes completely, because there are so many all across the project, but as the tests run and I see you mostly changed "stylistic" aspects that allow easier inference, and nothing works substantially differently, I'm going to merge this |
|
You're most welcome. Like I've said, I'd be happy to host an interactive session to show you folks my workflow for changes like these. Once you see how they are discovered, analyzed, and resolved it's all pretty straightforward. |
|
I ended up using my |
xref JuliaPlots/AbstractPlotting.jl#502