[Python-checkins] benchmarks: Support Jython's concept of an accelerated module
brett.cannon
python-checkins at python.org
Fri Oct 16 13:42:12 EDT 2015
https://hg.python.org/benchmarks/rev/03552c2af83a
changeset: 227:03552c2af83a
user: Brett Cannon <brett at python.org>
date: Fri Oct 16 10:42:08 2015 -0700
summary:
Support Jython's concept of an accelerated module
files:
performance/bm_pickle.py | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/performance/bm_pickle.py b/performance/bm_pickle.py
--- a/performance/bm_pickle.py
+++ b/performance/bm_pickle.py
@@ -66,7 +66,7 @@
'zip': ''}
TUPLE = (
- [long(x) for x in
+ [long(x) for x in
[265867233, 265868503, 265252341, 265243910, 265879514,
266219766, 266021701, 265843726, 265592821, 265246784,
265853180, 45526486, 265463699, 265848143, 265863062,
@@ -319,6 +319,10 @@
return times
+def is_module_accelerated(module):
+ return getattr(pickle.Pickler, '__module__', '<jython>') == 'pickle'
+
+
if __name__ == "__main__":
parser = optparse.OptionParser(
usage="%prog [pickle|unpickle] [options]",
@@ -346,14 +350,14 @@
import cPickle as pickle
else:
import pickle
- if pickle.Pickler.__module__ == 'pickle':
+ if is_module_accelerated(pickle):
raise RuntimeError("Missing C accelerators for pickle")
else:
if sys.version_info >= (3,):
sys.modules['_pickle'] = None
num_obj_copies = 200
import pickle
- if pickle.Pickler.__module__ != 'pickle':
+ if not is_module_accelerated(pickle):
raise RuntimeError("Unexpected C accelerators for pickle")
if options.protocol > 0:
--
Repository URL: https://hg.python.org/benchmarks
More information about the Python-checkins
mailing list