STINNER Victor added the comment: 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? ---------- nosy: +haypo Added file: http://bugs.python.org/file46759/bench_bit_length.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29782> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com