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

Commit

Permalink
BenchmarkDictCreate() & BenchmarkDictCreateFunc() (#226)
Browse files Browse the repository at this point in the history
In CPython the function form is twice as slow.
  • Loading branch information
cclauss authored and trotterdylan committed Jan 31, 2017
1 parent 53661bc commit 2ba303f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions benchmarks/dict.py
Expand Up @@ -19,6 +19,16 @@
import weetest


def BenchmarkDictCreate(b):
for _ in xrange(b.N):
d = {'one': 1, 'two': 2, 'three': 3}


def BenchmarkDictCreateFunc(b):
for _ in xrange(b.N):
d = dict(one=1, two=2, three=3)


def BenchmarkDictGetItem(b):
d = {42: 123}
for _ in xrange(b.N):
Expand Down

0 comments on commit 2ba303f

Please sign in to comment.