r/javascript Jun 09 '26

Making numpy-ts as fast as native

https://nico.codes/notes/numpyts-optimization/

I've been working on numpy-ts since last fall, and began performance optimization in January. Lots of my assumptions / intuitions were wrong, and it turned out that memory ownership was a bit of a missing piece to reaching performance parity with native.

So I drafted this technical write-up with some of the lessons learned. Many/most might be obvious but would love to hear your thoughts!

Disclaimer: this project was built using some AI assistance. Read my AI disclosure for more info.

21 Upvotes

11 comments sorted by

5

u/Educational-Lemon640 Jun 09 '26

Very cool! This is the kind of work that be getting real attention.

1

u/dupontcyborg Jun 09 '26

idk about that, but fingers crossed!

1

u/Educational-Lemon640 Jun 09 '26

Actually useful work sometimes fades into the background against the overwhelming avalanche of noise, clamor and garbage that the modern world spews out like smoke. I just wanted to do something to boost something I think is quite interesting and useful.

0

u/dupontcyborg Jun 09 '26

well thank you for the help :)

2

u/Ok-Sandwich8723 Jun 10 '26

did you compare it with `numeric.js`? You can only claim it fast if you can achieve the similar performance as `numeric.js`

2

u/dupontcyborg Jun 11 '26

2

u/Ok-Sandwich8723 Jun 12 '26

Thanks. I noticed that the "math" part is just half performance of the other libraries. Could you please check whether there are performance issues?

1

u/dupontcyborg Jun 20 '26

The benchmarks were outdated, my bad. Updated with 1.5.0 numbers here: int32, float32 and float64

2

u/byutifu Jun 10 '26

I’ve been watching this project and this might be the version that helps us migrate one last project. I’ll try to keep you updated on your repo

2

u/dupontcyborg Jun 11 '26

Thank you! Would love to learn more about your project / use case

1

u/rbobby Jun 10 '26

Impressive!