summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-01-06 10:33:56 +0000
committerRaymond Hettinger <python@rcn.com>2003-01-06 10:33:56 +0000
commit698258a1991db03207353b8403bfff1287ba92cc (patch)
tree99962bd591b20d4f183f70f2b707b3b21aa15969 /Python
parent68b539ef9c9f7b4d038185669d486af35ba7ba02 (diff)
downloadcpython-git-698258a1991db03207353b8403bfff1287ba92cc.tar.gz
Optimize string_repeat.
Christian Tismer pointed out the high cost of the loop overhead and function call overhead for 'c' * n where n is large. Accordingly, the new code only makes lg2(n) loops. Interestingly, 'c' * 1000 * 1000 ran a bit faster with old code. At some point, the loop and function call overhead became cheaper than invalidating the cache with lengthy memcpys. But for more typical sizes of n, the new code runs much faster and for larger values of n it runs only a bit slower.
Diffstat (limited to 'Python')
0 files changed, 0 insertions, 0 deletions