Why is hash() slower under python3.4 vs python2.7
问题 I was doing some performance evaluation using timeit and discovered a performance degredation between python 2.7.10 and python 3.4.3. I narrowed it down to the hash() function: python 2.7.10: >>> import timeit >>> timeit.timeit('for x in xrange(100): hash(x)', number=100000) 0.4529099464416504 >>> timeit.timeit('hash(1000)') 0.044638872146606445 python 3.4.3: >>> import timeit >>> timeit.timeit('for x in range(100): hash(x)', number=100000) 0.6459149940637872 >>> timeit.timeit('hash(1000)') 0