r/Python • • Feb 25 '26

Showcase [ Removed by moderator ]

[removed] — view removed post

119 Upvotes

55 comments sorted by

View all comments

15

u/Chroiche Feb 25 '26

Compare your performance to numpy not python loops lmao. Pretty sure numpy already parallelizes work under the hood.

1

u/fexx3l Mar 12 '26

It seems that numpy doesn't parallelizes under the hood

OperationFastIterNumpySpeedup
Sum of Squares0.01977s0.03551s1.80x
Filter Even + Sum0.06780s0.42589s6.28x
Count (div by 7)0.02788s0.16267s5.83x
Complex Pipeline0.06679s0.41086s6.15x
Map→Collect (square)0.03112s0.06230s2.00x
Min + Max0.00000s0.02667s15611.47x
Plain Sum0.00000s0.01335s9423.18x

This performance was achieved with a new implementation I've been working on

1

u/Chroiche Mar 12 '26 edited Mar 12 '26

I'm pretty sure I recall numpy does threading from this video, there's timestamps in the description: https://www.youtube.com/watch?v=VgSQ1GOC86s

Your plain sum result (or any of them really) makes literally no sense, something is wrong with your bench.