Skip to content

Conversation

@vstinner
Copy link
Member

@vstinnervstinner commented Oct 10, 2024

@vstinner
Copy link
MemberAuthor

Benchmark:

import pyperf runner = pyperf.Runner() runner.bench_func('repr(())', repr, ()) runner.bench_func("repr(('abc',))", repr, ('abc',)) runner.bench_func('repr((1,2,3))', repr, (1, 2, 3)) tuple4 = ('abcdef',) * 10 runner.bench_func('repr(tuple4)', repr, tuple4) tuple5 = ('abcdef',) * 50 runner.bench_func('repr(tuple5)', repr, tuple5) 

Result on Python built with ./configure CC=clang LD=clang --with-lto=thin, CPU isolation, benchmark run with --rigorous:

+----------------+---------+-----------------------+ | Benchmark | main | change | +================+=========+=======================+ | repr(()) | 55.0 ns | 55.9 ns: 1.02x slower | +----------------+---------+-----------------------+ | repr(('abc',)) | 210 ns | 239 ns: 1.14x slower | +----------------+---------+-----------------------+ | repr((1,2,3)) | 290 ns | 189 ns: 1.54x faster | +----------------+---------+-----------------------+ | repr(tuple4) | 850 ns | 870 ns: 1.02x slower | +----------------+---------+-----------------------+ | Geometric mean | (ref) | 1.05x faster | +----------------+---------+-----------------------+ Benchmark hidden because not significant (1): repr(tuple5) 

@vstinnervstinner enabled auto-merge (squash) October 10, 2024 10:13
@vstinnervstinner merged commit 82dfdc3 into python:mainOct 10, 2024
@vstinnervstinner deleted the writer_tuple branch October 10, 2024 10:20
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@vstinner