4 ms·
You would use sum(range()) in a Python though. Remember that many things you do manually in JS have a better, automatic and faster way in the stlib. Besides, i
by sametmax 8y ago
You would use sum(range()) in a Python though. Remember that many things you do manually in JS have a better, automatic and faster way in the stlib.
Besides, if calculations are important, you would use numpy.
- tim333 8y agoAh yes. sum(range()) in Python vs for(i=1...) in js was much closer, about 20% quicker in javascript.
- gengkev 8y agoWon't this calculation overflow to +Infinity in JavaScript after a while? On the other hand, Python will try to compute the actual result using arbitrary precision integers, which is that's slower.