Message175097
> Serhiy, the performance of hash() for long strings isn't very relevant for the general performance of a Python program.
It exposes the raw speed of hashing algorithm. It is good as a first estimate, because more real cases require more sophisticated measurements.
> Short strings dominate. I've modified the timeit to create a new string object every time.
timeit is absolutely not suitable for this. Need to write a C program that uses the Python C API.
> for I in 5 10 15 20 30 40 50 60; do echo -ne "$I\t"; ./python -m timeit -n100000 -r30 -s "h = hash; x = 'ä' * $I" -- "h(x + 'a')" | awk '{print $6}' ; done
Please, do not be fooled by the wrong measurements. You measure the height of the building together with the hill, on which it stands. Use "-n1" and you will see a
completely different numbers. |
|
Date |
User |
Action |
Args |
2012-11-07 12:55:50 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, lemburg, arigo, mark.dickinson, vstinner, christian.heimes, benjamin.peterson, Arfrever, alex, dmalcolm, Giovanni.Bajo, PaulMcMillan, Vlado.Boza, koniiiik, camara |
2012-11-07 12:55:50 | serhiy.storchaka | link | issue14621 messages |
2012-11-07 12:55:50 | serhiy.storchaka | create | |
|