-
Notifications
You must be signed in to change notification settings - Fork 16
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
add get_hash, make DAGs deterministic #457
Conversation
0741493
to
541d94f
Compare
How does this relate to |
541d94f
to
df96738
Compare
Hmm, I'm not sure - I could only imagine using a |
e97fdbd
to
8b8e66f
Compare
Some (discouraging) performance results regarding other dict implementations: import immutables
import frozendict
import immutabledict
import timeit
d_init = {}
print("init_dict", timeit.timeit("for i in range(10000000): d_init[i] = i", globals=globals(), number=3))
d = dict(d_init)
print("dict", timeit.timeit(
"for k, v in d.items(): s += 1", globals=globals(), number=3, setup="s=0"))
d = immutabledict.immutabledict(d_init)
print("immutabledict", timeit.timeit(
"for k, v in d.items(): s += 1", globals=globals(), number=3, setup="s=0"))
d = frozendict.frozendict(d_init)
print("frozendict", timeit.timeit(
"for k, v in d.items(): s += 1", globals=globals(), number=3, setup="s=0"))
d = immutables.Map(d_init)
print("immutables", timeit.timeit(
"for k, v in d.items(): s += 1", globals=globals(), number=3, setup="s=0"))
|
This is surprising. Also, I'm not sure that iteration is the most salient thing to benchmark, I would imagine creation is likely more important. Also, since most of our dicts are going to be quite small: If we model cost as And: a cheap win might be had by simply feeding the single-file implementation of |
Adding an explicit implementation for |
Oh cool. So we may have a winner? |
(After a PR to that package, at least?) |
Yep, I'm working on a PR (corenting/immutabledict#265). |
We didn't finish the discussion in the morning - is there still value in this PR? From what I can see, there are 3 pieces here:
|
Could you explain what If the answer is "make the hash consistent" run-over-run, I'm not sure I like that idea. |
Right, in that case there wouldn't really a difference between |
No description provided.