-
Notifications
You must be signed in to change notification settings - Fork 9
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
dynamic dispatch in Proj.proj_trans #104
Comments
Did you try looking at a profile? E.g. ProfileView.jl? It will show allocs and instability in yellow and red |
I mean a sampling profiler like ProfileView.jl. Thats the best tool for this job because it will instantly show where the allocations are coming from. Just run that code a lot of times inside a function with a loop in it, and put |
I mean, AllocCheck is pretty clear about where it's happening, line 494 of Proj.jl. I just don't know why it's a dynamic dispatch, or how it would be fixed. |
But... the profile will show if its type instability (boxing) causing allocation, or just regular allocation, red or yellow in the profile. (Likely red given dynamic dispatch warning). It also gives context you need to understand type instability/dynamic dispatch. They are totally unrelated reasons for allocation and totally different fixes. If its red, use Cthulu.jl If yellow, investigate possible allocations like Compared to the ProfileView/Cthulhu combo AllocCheck is a blunt instrument. You need to see the context. |
I can't see this allocation or any instability in ProfileView from my end. I do see the same error from AllocCheck, though. Perhaps the "dynamic dispatch" here is really triggering on the julia> @benchmark Proj.proj_trans($pj, $(Proj.PJ_FWD), $a)
BenchmarkTools.Trial: 10000 samples with 911 evaluations.
Range (min … max): 114.572 ns … 2.863 μs ┊ GC (min … max): 0.00% … 0.00%
Time (median): 120.518 ns ┊ GC (median): 0.00%
Time (mean ± σ): 123.166 ns ± 33.619 ns ┊ GC (mean ± σ): 0.00% ± 0.00%
▃ ▂▃▅█▄▄▄▆▆▅▄▂▂▁▁▁▁▁ ▂
█▆▄█████████████████████▇▇▇▇▇▇▇▆▅▆▆▆▆▆▅▆▅▅▆▆▆▅▅▄▅▄▅▄▄▄▃▄▄▄▄▄ █
115 ns Histogram: log(frequency) by time 158 ns <
Memory estimate: 0 bytes, allocs estimate: 0. |
If there is nothing in the profile that suggests there isn't actually a problem. Time of 100ns and no allocs in |
Hello,
I'm using Proj in some code where I'm trying to avoid allocations and dynamic dispatches for performance. To assist with this, I'm using the AllocCheck.jl packages, which finds allocations and dynamic dispatches in the code. So this example:
gives the following error message:
I don't know enough about
@ccall
to be able to tell what the issue is, if there is one. Any suggestions would be appreciated!The text was updated successfully, but these errors were encountered: