Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

> I've had the displeasure of porting 4k sloc of Mathematica to python and the script runtime went from 40min to 5sec

While i can't comment on perf, how much of this is due to a rewrite taking advantage of knowledge learned? Would a rewrite in mathematica have been quicker than 40m?



I'd wonder if the Mathematica code was using fast constructs to begin with.

It's best to think of Mathematica as being similar to Python + Numpy. If you want your code to be fast, you want to spend as much time in the kernel (Numpy) as possible. That's why you'll want to take advantage of functional programming constructs, listable functions, etc. if you want to write fast Mathematica code.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: