# HG changeset patch # User Bobby Impollonia # Date 1289685126 28800 # Branch 2n3 # Node ID 62bc6a362d94e13aee3a19694fd89cc5e6d8bea6 # Parent 89ec3b0eb315daec82a4b5338d7e23becffffc24 Add slow (pure-python) pickle support for py3k diff -r 89ec3b0eb315 -r 62bc6a362d94 perf.py --- a/perf.py Fri Nov 12 21:53:26 2010 +0100 +++ b/perf.py Sat Nov 13 13:52:06 2010 -0800 @@ -1487,11 +1487,11 @@ base_python, changed_python, options, extra_args) -def BM_Pickle(base_python, changed_python, options): +def BM_FastPickle(base_python, changed_python, options): args = ["--use_cpickle", "pickle"] return _PickleBenchmark(base_python, changed_python, options, args) -def BM_Unpickle(base_python, changed_python, options): +def BM_FastUnpickle(base_python, changed_python, options): args = ["--use_cpickle", "unpickle"] return _PickleBenchmark(base_python, changed_python, options, args) @@ -1861,16 +1861,17 @@ "bzr_startup", "hg_startup"], "regex": ["regex_v8", "regex_effbot", "regex_compile"], "threading": ["threaded_count", "iterative_count"], - "cpickle": ["pickle", "unpickle"], + "pickle": ["slowpickle", "slowunpickle", + "fastpickle", "fastunpickle"], "apps": ["2to3", "html5lib", "rietveld", "spambayes"], "calls": ["call_simple", "call_method", "call_method_slots", "call_method_unknown"], "math": ["nbody", "float", "pidigits"], # After 2to3-conversion "py3k": ["2to3", "calls", "math", "normal_startup", - "startup_nosite", "cpickle", "threading", "regex"], + "startup_nosite", "pickle", "threading", "regex"], # Benchmarks natively 2.x- and 3.x-compatible - "2n3": ["calls", "math", "cpickle", "regex", "threading", + "2n3": ["calls", "math", "pickle", "regex", "threading", "nqueens", "unpack_sequence", "richards", "normal_startup", "startup_nosite"], } diff -r 89ec3b0eb315 -r 62bc6a362d94 performance/bm_pickle.py --- a/performance/bm_pickle.py Fri Nov 12 21:53:26 2010 +0100 +++ b/performance/bm_pickle.py Sat Nov 13 13:52:06 2010 -0800 @@ -346,12 +346,15 @@ import cPickle as pickle else: import pickle + if pickle.Pickler.__module__ == 'pickle': + raise RuntimeError("Missing C accelerators for pickle") else: if sys.version_info >= (3,): - # Not entirely true, but I'm lazy - raise RuntimeError("No pure Python pickling under 3.x") + sys.modules['_pickle'] = None num_obj_copies = 200 import pickle + if pickle.Pickler.__module__ != 'pickle': + raise RuntimeError("Unexpected C accelerators for pickle") if options.protocol > 0: num_obj_copies *= 2 # Compensate for faster protocols.