summaryrefslogtreecommitdiffstats
path: root/Tools/idle
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-05-08 22:33:50 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-05-08 22:33:50 (GMT)
commit5b4d47756871a11621dc4d96e58a9180479704f3 (patch)
tree5cac00d2457b3fa2b112471344b97618d859527d /Tools/idle
parent61dff2b285249485ab2f57f7200d4c50b741c610 (diff)
downloadcpython-5b4d47756871a11621dc4d96e58a9180479704f3.zip
cpython-5b4d47756871a11621dc4d96e58a9180479704f3.tar.gz
cpython-5b4d47756871a11621dc4d96e58a9180479704f3.tar.bz2
Intern 1-character strings as soon as they're created. As-is, they aren't
interned when created, so the cached versions generally aren't ever interned. With the patch, the Py_INCREF(t); *p = t; Py_DECREF(s); return; indirection block in PyString_InternInPlace() is never executed during a full run of the test suite, but was executed very many times before. So I'm trading more work when creating one-character strings for doing less work later. Note that the "more work" here can happen at most 256 times per program run, so it's trivial. The same reasoning accounts for the patch's simplification of string_item (the new version can call PyString_FromStringAndSize() no more than 256 times per run, so there's no point to inlining that stuff -- if we were serious about saving time here, we'd pre-initialize the characters vector so that no runtime testing at all was needed!).
Diffstat (limited to 'Tools/idle')
0 files changed, 0 insertions, 0 deletions