This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients asvetlov, christian.heimes, gregory.p.smith, jcea, mark.dickinson, pitrou, python-dev, serhiy.storchaka, skrah, tim.peters, vstinner
Date 2013-04-08.21:51:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1365457863.66.0.949208847683.issue16427@psf.upfronthosting.co.za>
In-reply-to
Content
fast_hash_3.patch is a litte bit (6%) slower for Unicode string shorter than 10 characters, but much faster for string equal or longer than 100 characters (up to 10x faster).

I used the str type and disabled its cache ("_PyUnicode_HASH(self) = x;" in unicode_hash()) to run my benchmark.


Summary        |   original |        patched
---------------+------------+---------------
Length 1       | 231 ns (*) |   244 ns (+6%)
Length 3       | 238 ns (*) |   253 ns (+6%)
Length 10      | 254 ns (*) |         251 ns
Length 20      | 280 ns (*) |   256 ns (-8%)
Length 100     | 528 ns (*) |  321 ns (-39%)
Length 10 ** 4 |  32 us (*) | 9.49 us (-70%)
Length 10 ** 8 | 329 ms (*) |  104 ms (-68%)
---------------+------------+---------------
Total          | 329 ms (*) |  104 ms (-68%)
History
Date User Action Args
2013-04-08 21:51:03vstinnersetrecipients: + vstinner, tim.peters, gregory.p.smith, jcea, mark.dickinson, pitrou, christian.heimes, asvetlov, skrah, python-dev, serhiy.storchaka
2013-04-08 21:51:03vstinnersetmessageid: <1365457863.66.0.949208847683.issue16427@psf.upfronthosting.co.za>
2013-04-08 21:51:03vstinnerlinkissue16427 messages
2013-04-08 21:51:03vstinnercreate