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

Benchmarking the performance of dictionaries #35

Open
eulerkochy opened this issue Feb 20, 2020 · 4 comments
Open

Benchmarking the performance of dictionaries #35

eulerkochy opened this issue Feb 20, 2020 · 4 comments

Comments

@eulerkochy
Copy link
Member

Benchmarking code for the dictionaries is not present at the moment. I'll be happy to write a benchmark for the dictionaries. A sign of approval/necessity is all that I am waiting for !

@oxinabox
Copy link
Member

Yes, that would be great.

The current code for benchmarking in DataStructures.jl is nice a setup using PkgBenchmarks.jl
https://github.com/JuliaCollections/DataStructures.jl/tree/master/benchmark

@PallHaraldsson
Copy link
Contributor

Please do, or I will... for the OrderedDict and variants, OrderedRobinDict, LittleDict (that is ordered and fastest, but only for small dicts) etc.

@eulerkochy
Copy link
Member Author

@PallHaraldsson I'd written a benchmark suite for AbstractDict types here. It can be extended to benchmark OrderedDicts as well. Please feel free to make a PR. I'm pretty loaded with coursework at this moment, but if it's urgent, cc me on the PR, I'll review it. 😄

@PallHaraldsson
Copy link
Contributor

PallHaraldsson commented Oct 18, 2020

Hi @eulerkochy, I ran your code, thanks! I'm not sure which operation is most important, maybe pop! or find-failure:

find-failure OrderedRobinDict{Int64,Int64}() 10^4 elem Int64 minimum time TrialEstimate(40.000 ns)
find-failure base-Dict{Int64,Int64}() 10^4 elem Int64 minimum time TrialEstimate(59.000 ns)
find-failure SwissDict() 10^4 elem Int64 minimum time TrialEstimate(40.000 ns)

It's good to know OrderedRobinDict isn't slower (for this) than Base. Would you recommend that or something else, e.g. your new OrderedGeneralDict, I just discovered (as not merged), to replace Dict in Base? I thought one of the objection to change to ordered by default would be some new unordered might be even faster, and your SwissDict, should be the go to option to look into?

julia> filter_result(results, "pop!", "Dict")
pop! SwissDict{Float64,Float64}() 10^4 elem Float64 memory 0.0 kB
pop! SwissDict{Float64,Float64}() 10^4 elem Float64 minimum time TrialEstimate(47.000 ns)
pop! OrderedRobinDict{Float64,Float64}() 10^4 elem Float64 memory 0.0 kB
pop! OrderedRobinDict{Float64,Float64}() 10^4 elem Float64 minimum time TrialEstimate(90.000 ns)
pop! OrderedRobinDict() 10^4 elem Int64 memory 0.0 kB
pop! OrderedRobinDict() 10^4 elem Int64 minimum time TrialEstimate(96.000 ns)
pop! SwissDict() 10^4 elem Float64 memory 0.0 kB
pop! SwissDict() 10^4 elem Float64 minimum time TrialEstimate(62.000 ns)
pop! OrderedRobinDict() 10^4 elem Float64 memory 0.0 kB
pop! OrderedRobinDict() 10^4 elem Float64 minimum time TrialEstimate(87.000 ns)
pop! base-Dict() 10^4 elem Float64 memory 0.0 kB
pop! base-Dict() 10^4 elem Float64 minimum time TrialEstimate(43.000 ns)
pop! base-Dict() 10^4 elem Int64 memory 0.0 kB
pop! base-Dict() 10^4 elem Int64 minimum time TrialEstimate(41.000 ns)
pop! SwissDict{Int64,Int64}() 10^4 elem Int64 memory 0.0 kB
pop! SwissDict{Int64,Int64}() 10^4 elem Int64 minimum time TrialEstimate(53.000 ns)
pop! OrderedRobinDict{Int64,Int64}() 10^4 elem Int64 memory 0.0 kB
pop! OrderedRobinDict{Int64,Int64}() 10^4 elem Int64 minimum time TrialEstimate(121.000 ns)
pop! base-Dict{Int64,Int64}() 10^4 elem Int64 memory 0.0 kB
pop! base-Dict{Int64,Int64}() 10^4 elem Int64 minimum time TrialEstimate(51.000 ns)
pop! SwissDict() 10^4 elem Int64 memory 0.0 kB
pop! SwissDict() 10^4 elem Int64 minimum time TrialEstimate(52.000 ns)
pop! base-Dict{Float64,Float64}() 10^4 elem Float64 memory 0.0 kB
pop! base-Dict{Float64,Float64}() 10^4 elem Float64 minimum time TrialEstimate(44.000 ns)

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

No branches or pull requests

3 participants