[pypy-svn] r40963 - pypy/dist/pypy/doc

cfbolz at codespeak.net cfbolz at codespeak.net
Wed Mar 21 19:04:07 CET 2007


Author: cfbolz
Date: Wed Mar 21 19:04:05 2007
New Revision: 40963

Modified:
   pypy/dist/pypy/doc/object-optimizations.txt
Log:
a small section about ropes


Modified: pypy/dist/pypy/doc/object-optimizations.txt
==============================================================================
--- pypy/dist/pypy/doc/object-optimizations.txt	(original)
+++ pypy/dist/pypy/doc/object-optimizations.txt	Wed Mar 21 19:04:05 2007
@@ -48,7 +48,36 @@
 string.  There is also a minimum number of characters below which being lazy
 is not saving any time over making the copy).
 
-You can this feature enable with the :config:`objspace.std.withstrslice` option.
+You can enable this feature with the :config:`objspace.std.withstrslice` option.
+
+
+Ropes
+-----
+
+Ropes are a general flexible string implementation, following the paper `"Ropes:
+An alternative to Strings."`_ by Boehm, Atkinson and Plass. Strings are
+represented as balanced concatenation trees, which makes slicing and
+concatenation of huge strings efficient.
+
+Using ropes is usually not a huge benefit for normal Python programs that use
+the typical pattern of appending substrings to a list and doing a
+``"".join(l)`` at the end. If ropes are used, there is no need to do that.
+A somewhat silly example of things you can do with them is this::
+
+    $ bin/py.py --objspace-std-withrope
+    faking <type 'module'>
+    PyPy 0.99.0 in StdObjSpace on top of Python 2.4.4c1 (startuptime: 17.24 secs)
+    >>>> import sys
+    >>>> sys.maxint
+    2147483647
+    >>>> s = "a" * sys.maxint
+    >>>> s[10:20]
+    'aaaaaaaaaa'
+
+
+You can enable this feature with the :config:`objspace.std.withrope` option.
+
+.. _`"Ropes: An alternative to Strings."`: http://www.cs.ubc.ca/local/reading/proceedings/spe91-95/spe/vol25/issue12/spe986.pdf
 
 Integer optimizations
 =====================



More information about the Pypy-commit mailing list