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

Faster propertynames when no dynamic properties are present #7

Merged
merged 2 commits into from
Aug 25, 2024

Conversation

Tortar
Copy link
Collaborator

@Tortar Tortar commented Aug 24, 2024

julia> using DynamicStructs, BenchmarkTools

julia> @dynamic struct Spaceship
           name::String
       end

julia> ship = Spaceship("Hail Mary")
Spaceship:
  1 field:
    name::String = "Hail Mary"
  no properties:

julia> @benchmark propertynames($ship)

#now
BenchmarkTools.Trial: 10000 samples with 1000 evaluations.
 Range (min  max):  3.366 ns  9.157 ns  ┊ GC (min  max): 0.00%  0.00%
 Time  (median):     3.417 ns             ┊ GC (median):    0.00%
 Time  (mean ± σ):   3.428 ns ± 0.184 ns  ┊ GC (mean ± σ):  0.00% ± 0.00%

                 ▂         ▇█                                
  ▂▁▁▁▁▇▁▁▁▁▄▁▁▁▁█▁▁▁▁▄▃▁▁▁██▁▁▁▇▇▁▁▁▃▄▁▁▁▁▄▁▁▁▁▂▁▁▁▁▄▁▁▁▁▂ ▃
  3.37 ns        Histogram: frequency by time       3.48 ns <

 Memory estimate: 0 bytes, allocs estimate: 0.

#before
BenchmarkTools.Trial: 10000 samples with 961 evaluations.
 Range (min  max):   87.211 ns  449.909 ns  ┊ GC (min  max): 0.00%  0.00%
 Time  (median):     110.210 ns               ┊ GC (median):    0.00%
 Time  (mean ± σ):   111.196 ns ±  10.671 ns  ┊ GC (mean ± σ):  0.00% ± 0.00%

                                        ▁▃▇█▇█▇▄▂▁▁              
  ▂▁▁▁▁▁▁▁▁▁▂▂▂▂▁▁▂▂▁▁▁▁▁▁▁▁▁▁▁▁▂▂▂▂▃▄▆████████████▇▇▆▅▄▄▃▃▃▂▂▂ ▄
  87.2 ns          Histogram: frequency by time          119 ns <

 Memory estimate: 32 bytes, allocs estimate: 2.

Copy link

codecov bot commented Aug 25, 2024

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@AntonOresten
Copy link
Owner

Neat! I hadn't thought of this.

Well done, and thanks for contributing!

@AntonOresten AntonOresten merged commit 2212ff6 into AntonOresten:main Aug 25, 2024
5 checks passed
@Tortar
Copy link
Collaborator Author

Tortar commented Aug 25, 2024

thanks for the package, as I said I think it can be very useful! Actually I'm trying to push for its integration in Agents.jl: JuliaDynamics/Agents.jl#1070, let's see how it goes :-)

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