summaryrefslogtreecommitdiffstats
path: root/Include/stringobject.h
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-03-29 03:29:08 (GMT)
committerTim Peters <tim.peters@gmail.com>2002-03-29 03:29:08 (GMT)
commit1f7df3595a0ddc5ef545d686bbb2933b11b7c8ce (patch)
tree6f6774880044bab55c1ba90903e75976912b8e23 /Include/stringobject.h
parent835840560bdd9edcf21186bace543e316fe921ca (diff)
downloadcpython-1f7df3595a0ddc5ef545d686bbb2933b11b7c8ce.zip
cpython-1f7df3595a0ddc5ef545d686bbb2933b11b7c8ce.tar.gz
cpython-1f7df3595a0ddc5ef545d686bbb2933b11b7c8ce.tar.bz2
Remove the CACHE_HASH and INTERN_STRINGS preprocessor symbols.
Diffstat (limited to 'Include/stringobject.h')
-rw-r--r--Include/stringobject.h30
1 files changed, 7 insertions, 23 deletions
diff --git a/Include/stringobject.h b/Include/stringobject.h
index a5d97fa..9049455 100644
--- a/Include/stringobject.h
+++ b/Include/stringobject.h
@@ -24,28 +24,18 @@ variant that assumes a zero-terminated string. Note that none of the
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_Format(PyObject *, PyObject *);
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)