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

Update BezierPath constructor #309

Merged

Conversation

hyrodium
Copy link
Contributor

@hyrodium hyrodium commented Apr 8, 2024

This is a slight performance improvement, but it would be better to avoid Any[] in the constructor.

Before this PR

julia> using Luxor, BenchmarkTools

julia> @benchmark BezierPath()
BenchmarkTools.Trial: 10000 samples with 981 evaluations.
 Range (min  max):  64.005 ns   3.877 μs  ┊ GC (min  max): 0.00%  95.72%
 Time  (median):     66.467 ns              ┊ GC (median):    0.00%
 Time  (mean ± σ):   74.230 ns ± 79.459 ns  ┊ GC (mean ± σ):  4.55% ±  4.48%

  ▃██▆▃▂▁▁  ▁▆▆▄▂▁                                            ▂
  █████████▇█████████▇▇▇▇▇▆▇▇▅▆▆▆▆▇▇█▇▇▇▇▆▆▆▅▆▄▄▅▅▄▆▅▄▄▅▄▄▄▃▄ █
  64 ns        Histogram: log(frequency) by time       119 ns <

 Memory estimate: 112 bytes, allocs estimate: 3.

After this PR

julia> using Luxor, BenchmarkTools

julia> @benchmark BezierPath()
BenchmarkTools.Trial: 10000 samples with 995 evaluations.
 Range (min  max):  29.151 ns   2.820 μs  ┊ GC (min  max): 0.00%  97.14%
 Time  (median):     31.849 ns              ┊ GC (median):    0.00%
 Time  (mean ± σ):   35.803 ns ± 51.047 ns  ┊ GC (mean ± σ):  4.30% ±  3.33%

  ▂▄▇██▇▅▃▂▁▄▅▄▂ ▁                              ▁             ▂
  ███████████████████▇█▇▇▇▆▆▄▆▆▅▃▅▄▃▅▃▄▅▄▄▅▄▆██████▇▆▆▆▇▇▇▇▆▆ █
  29.2 ns      Histogram: log(frequency) by time      64.1 ns <

 Memory estimate: 64 bytes, allocs estimate: 2.

@cormullion cormullion merged commit 4641522 into JuliaGraphics:master Apr 15, 2024
5 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants