3 ms·
> For code that is run once, writing time dominates. where "run once" in the sense you describe is really the case has been rare for me. Often these one off sc
by internetter 1y ago
> For code that is run once, writing time dominates.
where "run once" in the sense you describe is really the case has been rare for me. Often these one off scripts need to process data, which involves a loop, and all of the sudden, even if the script is only executed once, it must loop a million times and all of the sudden it is actually really slow and then I must go back and either beat the program into shape (time consuming) or let it execute over days. A third option is rewriting in a different language, and when I choose to do a 1:1 rewrite the time is often comparable to optimizing python, and the code runs faster than even the optimized python would've. Plus, these "one off" scripts often do get rerun, e.g. if more data is acquired.
Java is a sort of selective example. I find JavaScript similarly fast to write and it runs much faster.
- janalsncm 1y agoIn practice a lot of heavy lifting performance-dependent code is cython. For example numpy and PyTorch. So Python will definitely be faster than js if you use proper vectorized ops. The vast majority of my Python code is for data exploration and preprocessing which are usually one-offs or need to be run only a couple of times. Or maybe it’s a nightly job that takes 5 minutes instead of 30 seconds in another language, but it doesn’t matter because it’s not user facing. Actual Python execution time very rarely comes into play. If it does and it’s a problem, I will create a pyo3 rust binding.
- internetter 1y agoI think our processing workloads are just different. If you're spending 90% of your compute time in numpy or whatever sure. But for me that wasn't the case, the overhead absolutely was the python.