Created
February 9, 2011 12:21
-
-
Save Kami/818383 to your computer and use it in GitHub Desktop.
PyPy benchmark example code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import time | |
import waxeye | |
from ckparser import Parser | |
p = Parser() | |
queries = [ | |
# Simple queries | |
'node:foo', | |
'node:"foo"', | |
'node:"foo bar"', | |
'-node:foo', | |
'tag:foo', | |
'tag:"foo"', | |
'tag:"foo bar"', | |
'provider:aws', | |
'provider:"aws"', | |
'provider:AWS', | |
# Advanced queries | |
'node:foo AND tag:bar', | |
'node:foo AND tag:bar OR provider:AWS', | |
'node:"foo bar" OR tag:"bar foo" AND provider:"gogrid" OR tag:dev', | |
'node:"foo bar" OR tag:"bar foo" AND (provider:"gogrid" OR tag:db)', | |
'node:"foo bar" OR tag:"bar foo" AND -(provider:"gogrid" OR tag:-db)' | |
] | |
start = time.time() | |
for x in range (0, 10000): | |
for query in queries: | |
ast = p.parse(query) | |
end = time.time() | |
diff = end - start | |
print '%s' % diff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment