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
Benchmark for Contains #10
Comments
Well the thing is, contains isn't really needed. Get() will always return false if the key isn't present. Nonetheless contains() pretty much uses the same code as Get(). Not sure if a contains() benchmark will differ alot from the Get benchmark |
Right, I just noticed that the implementation of Dictionary.TryGetValue and Dictionary.ContainsKey is also pretty much the same. So you are correct that performance-wise Get and Contains are equivalent for all the collections. Do you think though that it would be interesting to have a benchmark where let's say half of the keys passed to Get() are not present in the map. I wonder if the results would be much different when searching for non-existent keys. |
The thing is... Right now there is no easy way to back out without
interating every entry. Should be an easy fix though.
Op do 23 feb. 2023 15:04 schreef miroslavp ***@***.***>:
… Right, I just noticed that the implementation of Dictionary.TryGetValue
and Dictionary.ContainsKey is also pretty much the same. So you are correct
that performance-wise Get and Contains are equivalent for all the
collections. Do you think though that it would be interesting to have a
benchmark where let's say half of the keys passed to Get() are not present
in the map. I wonder if the results would be much different when searching
for non-existent keys.
Thank you for your time!
—
Reply to this email directly, view it on GitHub
<#10 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD4KISPRK3TPTJ5ECRNYCJLWY5U7BANCNFSM6AAAAAAVFIMALM>
.
You are receiving this because you commented.Message ID: <Wsm2110/Faster.
***@***.***>
|
fixed, adding a benchmark later on |
Hi,
Do you have any rough idea how the Contains method of these collections compares to those in Dictionary and SlimDictionary in terms of performance? Can you add benchmarks when you get free time for cases when the key is present and not present in the collection?
Thank you for the great work!
The text was updated successfully, but these errors were encountered: