Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Python Patterns: An Optimization Anecdote. Parent comment
$ python -V
Python 2.5.2
$ python -m timeit -s 'v=["a"]' 'v.append("a")'
1000000 loops, best of 3: 0.199 usec per loop
$ python -m timeit -s 's="a"' 's+="a"'
10000000 loops, best of 3: 0.127 usec per loop
The string append is actually FASTER now. Tried with strings of length 5 and it is still faster.
There are no comments on this comment yet.
$ python -V
Python 2.5.2
$ python -m timeit -s 'v=["a"]' 'v.append("a")'
1000000 loops, best of 3: 0.199 usec per loop
$ python -m timeit -s 's="a"' 's+="a"'
10000000 loops, best of 3: 0.127 usec per loop
The string append is actually FASTER now. Tried with strings of length 5 and it is still faster.