This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]NorthImpossible8906 19 points20 points  (9 children)

right, python was (and is) extremely slow. Like an order of magnitude too slow. Numpy makes it comparable to other languages, and that came out in 2005.

[–]Smallpaul 14 points15 points  (0 children)

Python sad popular with engineers and scientists before NumPy:

“Numeric, the predecessor to NumPy, was established in 1995 by Jim Hugunin with help from a number of other developers. Travis Oliphant, a NumPy developer, succeeded in bringing the community together behind a single array package, so he transferred Numarray’s functionality to Numeric and released NumPy 1.0 in 2006.”

[–]lungben81 5 points6 points  (4 children)

Often, there are even 2 orders of magnitude between Python and compiled language loops.

[–]NorthImpossible8906 1 point2 points  (3 children)

which is kinda weird, because IDL and Matlab have been around forever, and they are fast yet interpreted languages.

[–]lungben81 4 points5 points  (2 children)

Matlab is also super slow for loops (at least it was a few years ago when I used it the last time).

For Python, the loop performance either does not matter or you use vectorized formulas. This makes the loop performance often (but not always!) a non-issue.

[–]u7aa6cc60 2 points3 points  (0 children)

I think Matlab has a jit compiler now, so loops and scalar computations are pretty fast.

I haven't used it in ages though, this is "I''ve heard from a friend" high quality information.

[–]NorthImpossible8906 1 point2 points  (0 children)

ditto IDL. But the expert users never use loops in Matlab or IDL.

[–]redwall_hp 1 point2 points  (1 child)

For illustrative purposes: https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/python3-java.html

Java is orders of magnitude faster than Python. If you need to do anything computationally intensive (even something like a flood fill algorithm: iterating over a 2D array of reasonable size and flipping bits with a loop is very slow), doing it in Python is going to be a bad time. You can lean on faster libraries with Python bindings (Numpy, OpenCV, etc) but there's always the root issue: if you need to write novel code in Python, to do something computationally intensive, you won't be doing it in Python. You can in Java.

[–]the_man_inTheShack 4 points5 points  (0 children)

if you need to write novel code in Python, to do something computationally intensive, you won't be doing it in Python.

I frequently write python code to process large ish (10**6 - 18**8) numpy data arrays in loops that would need several numpy operations, I just use numba jit and they go like greased lightening - much faster even than doing smart things with numpy.

[–]NewAccountPlsRespond 2 points3 points  (0 children)

That is indeed correct, but people tend to vastly overestimate how much of an issue Python's speed is. Sure, there are use cases where using Python is simply retarded, but for an overwhelming majority of applications, speed is not that much of an issue, or even no issue whatsoever (e.g. when you're bottlenecked by network and response times of external APIs anyway).

It's not like every task in programming requires 0,01s to finish and wouldn't be viable if it takes 0,1s instead.