Closed tkoolen closed 5 years ago
I've been noticing this too. I was curious if MeshCat itself was to blame, as I have a few parameterized types that could easily just have abstract fields, but making that change had no noticeable effect on the compilation time of MeshCat.
I think the first thing to do would be to try to separate loading the geometries from actually spawning the visualizer. I would be very interested in the relative timings of the three lines here: https://github.com/JuliaRobotics/MeshCatMechanisms.jl/blob/0295e987aa7da4fedf55fd8a0903a25ae2692a29/src/visualizer.jl#L17-L21
Would you be willing to try those three lines separately and see which one is the worst offender?
Almost all time is spent in
Not sure about the root cause yet.
Commenting out these lines:
makes the visual_elements
compilation time reasonable again. In particular, it seems to be the parse_link!
call.
Might be the nested map do
?
Much better now, but do you have any other ideas for what could be causing the remaining compilation latency?
I briefly tried using SnoopCompile to generate precompile statements for MeshCatMechanisms by the way, but that didn't help. I'm thinking it's probably due to compilation of third party code (meaning we'd have to add precompile statements to those other packages).
Anyway, it doesn't take anywhere close to a minute anymore, so I'll close this.
results in
70.614526 seconds (143.61 M allocations: 7.937 GiB, 5.79% gc time)
. Something is very wrong.Toml files.