Uh oh!
There was an error while loading. Please reload this page.
gh-125996: fix thread safety of ordered dict - #133734
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
colesbury
left a comment
There was a problem hiding this comment.
Would you please also provide some timing measurements for basic operations?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
kumaraditya303
commented
Jul 5, 2025
I added some benchmark for get/set operation to ftscaling and benchmarked it: index 1a59e25189d..20f15200051 100644
--- a/Tools/ftscalingbench/ftscalingbench.py+++ b/Tools/ftscalingbench/ftscalingbench.py@@ -28,6 +28,7 @@
import threading
import time
from operator import methodcaller
+from collections import OrderedDict
# The iterations in individual benchmarks are scaled by this factor.
WORK_SCALE = 100
@@ -43,6 +44,19 @@ def register_benchmark(func):
ALL_BENCHMARKS[func.__name__] = func
return func
+@register_benchmark+def odict_get():+ tab = OrderedDict((i, i) for i in range(100))+ for i in range(1000 * WORK_SCALE):+ tab.get(i % 100)++@register_benchmark+def odict_set():+ tab = OrderedDict((i, i) for i in range(100))+ for i in range(1000 * WORK_SCALE):+ tab[i % 100] = i++
@register_benchmark
def object_cfunction():
accu = 0
Results: ❯ ./python.exe Tools/ftscalingbench/ftscalingbench.py odict_get odict_setRunning benchmarks with 10 threadsodict_get 4.7x fasterodict_set 4.4x faster |
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Sam Gross <colesbury@gmail.com>
Uh oh!
There was an error while loading. Please reload this page.
Thanks @kumaraditya303 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Sorry, @kumaraditya303, I could not cleanly backport this to |
GH-140053 is a backport of this pull request to the 3.14 branch. |
pythonGH-133734) (cherry picked from commit 6481539) Co-authored-by: Kumar Aditya <kumaraditya@python.org>
bedevere-bot
commented
Oct 13, 2025
|
Uh oh!
There was an error while loading. Please reload this page.