Skip to content
This repository was archived by the owner on Mar 23, 2023. It is now read-only.

Commit 2ba303f

Browse files
cclausstrotterdylan
cclauss
authored andcommitted
BenchmarkDictCreate() & BenchmarkDictCreateFunc() (#226)
In CPython the function form is twice as slow.
1 parent 53661bc commit 2ba303f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

benchmarks/dict.py

+10
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@
1919
import weetest
2020

2121

22+
def BenchmarkDictCreate(b):
23+
for _ in xrange(b.N):
24+
d = {'one': 1, 'two': 2, 'three': 3}
25+
26+
27+
def BenchmarkDictCreateFunc(b):
28+
for _ in xrange(b.N):
29+
d = dict(one=1, two=2, three=3)
30+
31+
2232
def BenchmarkDictGetItem(b):
2333
d = {42: 123}
2434
for _ in xrange(b.N):

0 commit comments

Comments
 (0)