[Python-checkins] r75579 - sandbox/trunk/ccbench/ccbench.py
antoine.pitrou
python-checkins at python.org
Wed Oct 21 01:04:44 CEST 2009
Author: antoine.pitrou
Date: Wed Oct 21 01:04:43 2009
New Revision: 75579
Log:
Add a possible test, and add the regex test to the default tests
Modified:
sandbox/trunk/ccbench/ccbench.py
Modified: sandbox/trunk/ccbench/ccbench.py
==============================================================================
--- sandbox/trunk/ccbench/ccbench.py (original)
+++ sandbox/trunk/ccbench/ccbench.py Wed Oct 21 01:04:43 2009
@@ -81,8 +81,14 @@
# Taken from the `inspect` module
pat = re.compile(r'^(\s*def\s)|(.*(?<!\w)lambda(:|\s))|^(\s*@)', re.MULTILINE)
with open(__file__, "r") as f:
- arg = f.read(200)
+ arg = f.read(2000)
+ def findall(s):
+ t = time.time()
+ try:
+ return pat.findall(s)
+ finally:
+ print(time.time() - t)
return pat.findall, (arg, )
def task_sort():
@@ -91,7 +97,7 @@
l = l[::-1]
l.sort()
- return list_sort, (list(range(10000)), )
+ return list_sort, (list(range(1000)), )
def task_compress_zlib():
"""zlib compression (C)"""
@@ -124,7 +130,7 @@
return compute, (arg, )
-throughput_tasks = [task_pidigits]
+throughput_tasks = [task_pidigits, task_regex]
for mod in 'bz2', 'hashlib':
try:
globals()[mod] = __import__(mod)
@@ -262,7 +268,6 @@
_time = time.time
_sleep = time.sleep
def _ping():
- t = _time()
_sendto(sock, "%r\n" % _time(), addr)
# The first ping signals the parent process that we are ready.
_ping()
More information about the Python-checkins
mailing list