Repository navigation
gh-162350: Use AC for array.array constructor - #162419
skirpichev wants to merge 5 commits into
Conversation
This fixes it's signature and adds also support for Vectorcall protocol.
|
Microbenchmark (default options, gcc 14.2):
Detailsfrom array import array
import pyperf
runner = pyperf.Runner()
tp = 'i'
for xs in [[], [1], [1, 2], [1, 2, 3], list(range(100))]:
s = f"array of {len(xs)} elts"
runner.bench_func(s, array, tp, xs)No significant difference for scimark benchmark. |
cmaloney
left a comment
There was a problem hiding this comment.
Slightly outside these lines make_array currently exists and uses array_new which means an unnecessary tuple construction on pickle related code paths. Be nice to have the two make_array callers now just directly call array_new_impl (both have the right variables as locals already) which means make_array can go away entirely.
Lines 2170 to 2209 in 02fe78f
Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
|
A couple small changes with this but I think they're all reasonable:
|
|
I'll run scimark benchmark on this, but not expect too much, maybe few percents. Using AC for constructor seems to be a good idea anyway, due to removal of the internal helper and fixed signature. |
|
👍, I tried making the base rules for "what makes a good refactor" that: cases where it's just adding |
This fixes it's signature and adds also support for Vectorcall protocol.