Refactored benchmarks to conform to cpp spec

This commit is contained in:
Jason Paryani
2013-11-18 13:05:56 -08:00
parent 42da9f4101
commit 895f74547c
13 changed files with 175 additions and 122 deletions

View File

@@ -1,17 +1,12 @@
from random import random
import pyximport
importers = pyximport.install()
from common_fast import rand_int, rand_double, rand_bool
pyximport.uninstall(*importers)
WORDS = ["foo ", "bar ", "baz ", "qux ", "quux ", "corge ", "grault ", "garply ", "waldo ", "fred ",
"plugh ", "xyzzy ", "thud "]
def rand_int(val):
return int(random() * val)
def rand_double(val):
return random() * val
def rand_bool():
return random() < .5
def from_bytes_helper(klass):
def helper(text):
obj = klass()