Skip to content

Instantly share code, notes, and snippets.

@Kami Kami/gist:818383

Created Feb 9, 2011
Embed
What would you like to do?
PyPy benchmark example code
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
You can’t perform that action at this time.