[pypy-svn] r70872 - pypy/branch/stringbuilder2/pypy/rpython/lltypesystem
fijal at codespeak.net
fijal at codespeak.net
Tue Jan 26 11:37:20 CET 2010
Author: fijal
Date: Tue Jan 26 11:37:19 2010
New Revision: 70872
Modified:
pypy/branch/stringbuilder2/pypy/rpython/lltypesystem/ll_str.py
Log:
Preallocate temp buffer. Not thread-safe, to be measured
Modified: pypy/branch/stringbuilder2/pypy/rpython/lltypesystem/ll_str.py
==============================================================================
--- pypy/branch/stringbuilder2/pypy/rpython/lltypesystem/ll_str.py (original)
+++ pypy/branch/stringbuilder2/pypy/rpython/lltypesystem/ll_str.py Tue Jan 26 11:37:19 2010
@@ -4,13 +4,15 @@
CHAR_ARRAY = GcArray(Char)
+# It's more efficient, but not thread safe!
+temp = malloc(CHAR_ARRAY, 25)
+
def ll_int_str(repr, i):
return ll_int2dec(i)
ll_int_str._pure_function_ = True
def ll_int2dec(i):
from pypy.rpython.lltypesystem.rstr import mallocstr
- temp = malloc(CHAR_ARRAY, 20)
len = 0
sign = 0
if i < 0:
@@ -47,7 +49,6 @@
def ll_int2hex(i, addPrefix):
from pypy.rpython.lltypesystem.rstr import mallocstr
- temp = malloc(CHAR_ARRAY, 20)
len = 0
sign = 0
if i < 0:
@@ -89,7 +90,6 @@
result.hash = 0
result.chars[0] = '0'
return result
- temp = malloc(CHAR_ARRAY, 25)
len = 0
sign = 0
if i < 0:
More information about the Pypy-commit
mailing list