[issue46235] Do all ref-counting at once for sequence multiplication

2022-01-07 Thread Tim Peters
Change by Tim Peters : -- assignee: -> Dennis Sweeney resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue46235] Do all ref-counting at once for sequence multiplication

2022-01-07 Thread Tim Peters
Tim Peters added the comment: New changeset ad1d5908ada171eff768291371a80022bfad4f04 by Dennis Sweeney in branch 'main': bpo-46235: Do all ref-counting at once during list/tuple multiplication (GH-30346) https://github.com/python/cpython/commit/ad1d5908ada171eff768291371a80022bfad4f04

[issue46235] Do all ref-counting at once for sequence multiplication

2022-01-03 Thread Dennis Sweeney
Dennis Sweeney added the comment: Benchmarks are definitively better with the most recent change (in which the major data-copying loop is between parts of the same buffer): -- MSVC Slower (3): - (None,) * 2: 54.0 ns +- 0.7 ns -> 63.4 ns +- 2.5 ns: 1.17x slower -

[issue46235] Do all ref-counting at once for sequence multiplication

2022-01-03 Thread Dennis Sweeney
Dennis Sweeney added the comment: Hm... the effects are completely different on GCC. This is with --enable-optimizations and GCC on WSL: Slower (29): - tuple(range(100)) * 10: 1.22 us +- 0.02 us -> 2.29 us +- 0.05 us: 1.87x slower - tuple(range(100)) * 2: 345 ns +- 7 ns -> 629 ns +- 5 ns:

[issue46235] Do all ref-counting at once for sequence multiplication

2022-01-02 Thread Dennis Sweeney
Dennis Sweeney added the comment: # benchmarking script from pyperf import Runner runner = Runner() for n in [2, 10, 100, 10_000]: for A in [ '[None]', '["Python", "Perl"]', 'list(range(10))', 'list(range(100))', 'list(range(1000))',

[issue46235] Do all ref-counting at once for sequence multiplication

2022-01-02 Thread Dennis Sweeney
Change by Dennis Sweeney : -- keywords: +patch pull_requests: +28558 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30346 ___ Python tracker ___

[issue46235] Do all ref-counting at once for sequence multiplication

2022-01-02 Thread Dennis Sweeney
New submission from Dennis Sweeney : Some benchmarks for this change are below. The case with the largest speedup, `[None] * 1`, is the case that I would consider the most important: initializing counters of the form `[0] * N` is very common in my experience. The following were taken