Skip to content
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

using getting slower #222

Closed
PallHaraldsson opened this issue Feb 8, 2022 · 4 comments
Closed

using getting slower #222

PallHaraldsson opened this issue Feb 8, 2022 · 4 comments

Comments

@PallHaraldsson
Copy link

Hi, I really like the latest 3D additions. UnicodePlots has been getting slower over time while the new 3D stuff seems not to blame.

Last version to be fast;

(@v1.7) pkg> add UnicodePlots@2.5.1

julia> @time using UnicodePlots
  0.394906 seconds (494.24 k allocations: 31.595 MiB, 3.83% compilation time)

vs.

(@v1.7) pkg> add UnicodePlots@2.6.0

julia> @time using UnicodePlots
  1.362755 seconds (2.61 M allocations: 192.173 MiB, 2.56% gc time, 1.02% compilation time)

and for latest:
julia> @time using UnicodePlots
  1.352334 seconds (2.68 M allocations: 197.087 MiB, 2.62% gc time, 0.92% compilation time)

At least this make later: https://github.com/JuliaPlots/UnicodePlots.jl/pull/217/files

Do you know what might explain?

@t-bltg
Copy link
Member

t-bltg commented Feb 8, 2022

Thanks, it's great to see you like this !

This is explained by the added StaticArrays dependency through Contour since 2.6.0 (see #206 (comment)).

I'm not sure we can improve things here, since the increased loading time is due to an external dependency:

@time using StaticArrays
  0.909095 seconds (2.21 M allocations: 173.063 MiB, 3.48% gc time, 0.91% compilation time)

0.9s + 0.4s ≈ 1.3s

@johnnychen94
Copy link
Collaborator

johnnychen94 commented Feb 8, 2022

This is indeed inconvenient and unpleasant from the users' perspective.

From juliahub.com, StaticArrays is used by 2072 packages, which is more than 1/3 of the packages in the General registry. At best we can hope we've already loaded StaticArrays directly or indirectly in real usage, thus it won't be too inconvenient:

julia> @time using StaticArrays
  0.576627 seconds (2.21 M allocations: 172.026 MiB, 0.30% compilation time)

julia> @time using UnicodePlots
  0.242409 seconds (482.87 k allocations: 31.661 MiB, 0.79% compilation time)

There is a long recent thread in discourse about StaticArrays "When should a package move to the standard library or system image? StaticArrays, what is it?". Until StaticArrays itself get improved or replaced, I don't think we have many choices here.

@mcabbott
Copy link

How is StaticArrays used? It's not immediately obvious from searching the code. But since the above messages, there is now a StaticArraysCore package which is much lighter.

@t-bltg
Copy link
Member

t-bltg commented Nov 30, 2022

It is used to project 3d coordinates onto a 2d canvas (mostly @SMatrix).
The basis for handling volumetric data is here, and it is also used in 3d interfaces such as surfaceplot.

We use StaticArrays types (hence StaticArraysCore under the hood), but also StaticArrays functionalities, so we cannot solely depend on StaticArraysCore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants