New submission from Brian Kearns <[email protected]>:
Without changeset 519e4fca15cb, shown below, performance on the following
script
is 20% worse. Shouldn't they be able to be optimized equally well? Is this a
missed optimization?
diff --git a/lib-python/2/pickle.py b/lib-python/2/pickle.py
--- a/lib-python/2/pickle.py
+++ b/lib-python/2/pickle.py
@@ -1418,9 +1418,7 @@
'''
def __init__(self):
self.builder = StringBuilder()
-
- def write(self, data):
- self.builder.append(data)
+ self.write = self.builder.append
def getvalue(self):
return self.builder.build()
-------------------------------------------------------
import pickle
class Point(object):
def __init__(self, x, y):
self.x = x
self.y = y
def test():
n_loops = 200000
N = 2
data = [Point(x, y) for x in xrange(N) for y in xrange(N)]
for _ in xrange(n_loops):
len(pickle.dumps(data, pickle.HIGHEST_PROTOCOL))
test()
----------
messages: 5454
nosy: bdk, pypy-issue
priority: performance bug
status: unread
title: performance characteristics of pickle StringBuilder wrapper
________________________________________
PyPy bug tracker <[email protected]>
<https://bugs.pypy.org/issue1423>
________________________________________
_______________________________________________
pypy-issue mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-issue