New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do all ref-counting at once for sequence multiplication #90393
Comments
Some benchmarks for this change are below. The case with the largest speedup, The following were taken from a PGO build on Windows without CPU isolation, so take them with a grain of salt: Slower (16):
Faster (22):
Benchmark hidden because not significant (2): list(range(1000)) * 100, (None,) * 100 Geometric mean: 1.10x faster |
# 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))',
'(None,)',
'("Python", "Perl")',
'tuple(range(10))',
'tuple(range(100))',
'tuple(range(1000))',
]:
runner.timeit(
name=f"{A} * {n}",
setup=f"x = {A}",
stmt=f"x * {n}",
) |
Hm... the effects are completely different on GCC. This is with --enable-optimizations and GCC on WSL: Slower (29):
Faster (18):
Benchmark hidden because not significant (3): [None] * 100, [None] * 1000, [None] * 10000 Geometric mean: 1.01x slower |
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):
Faster (33):
Benchmark hidden because not significant (4): ("Python", "Perl") * 2, tuple(range(10)) * 2, (None,) * 10, tuple(range(1000)) * 100 Geometric mean: 1.21x faster -------- GCC PGO on WSL -------- Slower (4):
Faster (44):
Benchmark hidden because not significant (2): [None] * 100, [None] * 10000 Geometric mean: 1.32x faster |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: