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 mark.dickinson, niklasf, serhiy.storchaka, vstinner
Date 2017-03-27.15:36:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1490629018.88.0.958157217238.issue29782@psf.upfronthosting.co.za>
In-reply-to
Content
The change is an optimization, so it requires a benchmark, think you provided. Ok. But the speedup is a few nanoseconds on a function which takes currently 40 nanoseconds. It's not really what I would call significant:

$ ./python -m perf compare_to ref.json patch.json  --table
+---------------------+---------+-----------------------------+
| Benchmark           | ref     | patch                       |
+=====================+=========+=============================+
| int==float 8 digits | 39.2 ns | 37.9 ns: 1.03x faster (-3%) |
+---------------------+---------+-----------------------------+
| int==float 1 digit  | 38.0 ns | 37.9 ns: 1.00x faster (-0%) |
+---------------------+---------+-----------------------------+
| int.bit_length()    | 42.0 ns | 41.2 ns: 1.02x faster (-2%) |
+---------------------+---------+-----------------------------+

(See attached bench_bit_length.py script.)

So I'm not really convinced that the change is useful. Is bit_length() used in hot loops?
History
Date User Action Args
2017-03-27 15:36:58vstinnersetrecipients: + vstinner, mark.dickinson, serhiy.storchaka, niklasf
2017-03-27 15:36:58vstinnersetmessageid: <1490629018.88.0.958157217238.issue29782@psf.upfronthosting.co.za>
2017-03-27 15:36:58vstinnerlinkissue29782 messages
2017-03-27 15:36:58vstinnercreate