SpeedTests icon indicating copy to clipboard operation
SpeedTests copied to clipboard

racket: optimize example

Open Bogdanp opened this issue 9 months ago • 1 comments
trafficstars

This reduces the runtime on my M2 Max from 38 seconds to about 4.8s.

Bogdanp avatar Feb 18 '25 07:02 Bogdanp

Bump 👋

Bogdanp avatar Mar 06 '25 16:03 Bogdanp

Hi @jabbalaci, any thoughts on getting this merged? If there's no interest, I can just close it, but I want to take it off my list of open pull requests. Thanks!

Bogdanp avatar Mar 16 '25 06:03 Bogdanp

Will merge it today.

jabbalaci avatar Mar 16 '25 08:03 jabbalaci

Thanks!

Bogdanp avatar Mar 16 '25 12:03 Bogdanp

Thanks, it was added. If you want, you can add some explanation why it's faster. For instance, at JavaScript we have this line:

* `main2.js` is an improved implementation, using a more optimal cache array size

If you send a similar sentence, I'll update the README.

jabbalaci avatar Mar 16 '25 12:03 jabbalaci

Maybe something along the lines of: the improved code uses type-specific procedures to compute the results and for the cache, thereby reducing indirection and eliding runtime safety checks that the generic math procedures perform, but that are not necessary here. Feel free to reword that in any way you like!

Bogdanp avatar Mar 16 '25 14:03 Bogdanp