diff Include/stringobject.h @ 22651:f3a416b178c4 legacy-trunk

Remove the CACHE_HASH and INTERN_STRINGS preprocessor symbols.
author Tim Peters <tim.peters@gmail.com>
date Fri, 29 Mar 2002 03:29:08 +0000
parents 3d299b156511
children 220b98f06415
line wrap: on
line diff
--- a/Include/stringobject.h	Fri Mar 29 03:07:29 2002 +0000
+++ b/Include/stringobject.h	Fri Mar 29 03:29:08 2002 +0000
@@ -24,28 +24,18 @@
 functions should be applied to nil objects.
 */
 
-/* Two speedup hacks.  Caching the hash saves recalculation of a
-   string's hash value.  Interning strings (which requires hash
-   caching) tries to ensure that only one string object with a given
-   value exists, so equality tests are one pointer comparison.
-   Together, these can speed the interpreter up by as much as 20%.
-   Each costs the size of a long or pointer per string object.  In
-   addition, interned strings live until the end of times.  If you are
-   concerned about memory footprint, simply comment the #define out
-   here (and rebuild everything!). */
-#define CACHE_HASH
-#ifdef CACHE_HASH
-#define INTERN_STRINGS
-#endif
+/* Caching the hash (ob_shash) saves recalculation of a string's hash value.
+   Interning strings (ob_sinterned) tries to ensure that only one string
+   object with a given value exists, so equality tests can be one pointer
+   comparison.  This is generally restricted to strings that "look like"
+   Python identifiers, although the intern() builtin can be used to force
+   interning of any string.
+   Together, these sped the interpreter by up to 20%. */
 
 typedef struct {
     PyObject_VAR_HEAD
-#ifdef CACHE_HASH
     long ob_shash;
-#endif
-#ifdef INTERN_STRINGS
     PyObject *ob_sinterned;
-#endif
     char ob_sval[1];
 } PyStringObject;
 
@@ -70,15 +60,9 @@
 extern DL_IMPORT(PyObject *) _PyString_FormatLong(PyObject*, int, int,
 						  int, char**, int*);
 
-#ifdef INTERN_STRINGS
 extern DL_IMPORT(void) PyString_InternInPlace(PyObject **);
 extern DL_IMPORT(PyObject *) PyString_InternFromString(const char *);
 extern DL_IMPORT(void) _Py_ReleaseInternedStrings(void);
-#else
-#define PyString_InternInPlace(p)
-#define PyString_InternFromString(cp) PyString_FromString(cp)
-#define _Py_ReleaseInternedStrings()
-#endif
 
 /* Macro, trading safety for speed */
 #define PyString_AS_STRING(op) (((PyStringObject *)(op))->ob_sval)