[pypy-svn] r70959 - pypy/trunk/pypy/objspace/std
arigo at codespeak.net
arigo at codespeak.net
Thu Jan 28 19:57:48 CET 2010
Author: arigo
Date: Thu Jan 28 19:57:48 2010
New Revision: 70959
Modified:
pypy/trunk/pypy/objspace/std/stringobject.py
Log:
Comment: the trick that CPython does in ``"xyz" * 10000''.
Modified: pypy/trunk/pypy/objspace/std/stringobject.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/stringobject.py (original)
+++ pypy/trunk/pypy/objspace/std/stringobject.py Thu Jan 28 19:57:48 2010
@@ -861,6 +861,10 @@
"repeated string is too long: %d times %d characters",
mul, input_len)
# XXX maybe only do this when input has a big length
+ # XXX CPython tricks:
+ # - if input has length 1, use memset
+ # - otherwise, use memcpy to repeatedly double the size of the
+ # string (i.e. compute the "square" of the string)
return joined(space, [input] * mul)
def mul__String_ANY(space, w_str, w_times):
More information about the Pypy-commit
mailing list