| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
PyUnicodeWriter_WriteStr() and PyUnicodeWriter_WriteRepr() now call directly _PyLong_FormatWriter() if the object is an int.
|
Benchmark using PR gh-125202 as reference: import pyperf
runner = pyperf.Runner()
runner.bench_func('repr([1,2,3])', repr, [1, 2, 3])
list2 = [123]*10
runner.bench_func('repr(list2)', repr, list2)
list3 = [123]*50
runner.bench_func('repr(list3)', repr, list3)
Comparison without / with this change: +----------------+---------+-----------------------+ | Benchmark | ref | change | +================+=========+=======================+ | repr([1,2,3]) | 291 ns | 189 ns: 1.54x faster | +----------------+---------+-----------------------+ | repr(list2) | 822 ns | 498 ns: 1.65x faster | +----------------+---------+-----------------------+ | repr(list3) | 3.01 us | 1.56 us: 1.93x faster | +----------------+---------+-----------------------+ | Geometric mean | (ref) | 1.70x faster | +----------------+---------+-----------------------+ |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PyUnicodeWriter_WriteStr() and PyUnicodeWriter_WriteRepr() now call directly _PyLong_FormatWriter() if the object is an int.