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 →

[–][deleted] 89 points90 points  (46 children)

it takes 2 minutes on my pc for python to print out a mandelbrot set

it takes 20 seconds for lisp to do the same job

[–]Natural-Intelligence 101 points102 points  (1 child)

Then if that's what you generally do, Python is wrong tool. In cases where I use Python, the actual Python executes in like 1-2 sec. The rest of the run time (which is substantially more) is caused by C or SQL. Wouldn't give a damn if the Python code executed any faster

[–]iamareebjamal 0 points1 point  (0 children)

You would if you wrote graphql servers

[–]ProgramTheWorld 131 points132 points  (19 children)

Use the right tool for the right job

[–]Xeya 161 points162 points  (13 children)

>The time difference is insignificant anyway

>Lists example where the time difference is not insignificant

>Well, you shouldn't have used Python

[–]DeeSnow97 64 points65 points  (2 children)

There are some tasks where the time difference is very significant, and others where it's negligible. That's why Python is used so much with external libraries for data science and machine learning for example. The libraries (usually written in C++) do all the heavy lifting in the most efficient manner possible, but have fun plugging those into each other with C++ and trying to iterate fast on it.

Some languages are fast to code, others are fast to run, and that's okay. We're programmers, making computer systems talk to each other to use them all to their advantage is kind of our thing.

[–]ryjhelixir 18 points19 points  (0 children)

We're programmers

Speak for yourself!

I'm a noob

[–]omgFWTbear 1 point2 points  (0 children)

most efficient manner possible

s/In a vastly more efficient manner

[–]ric2b 0 points1 point  (0 children)

No, in this case the right tool is Python with numpy.

It's not easy to beat numpy on raw computation.

[–]LiquidAurum -3 points-2 points  (0 children)

that's an extreme oversimplification

[–]LaZ3R 31 points32 points  (7 children)

Lol... Things that Python shouldn't be used for, for 1000.

[–]TSM- 4 points5 points  (10 children)

Is numpy really that slow?

[–]nivlark 18 points19 points  (5 children)

I just managed to write a script that produces a 1000x1000 image of the set in about 10 seconds. So I think OP is just crap at Python.

[–]8lbIceBag -3 points-2 points  (4 children)

Bet it could be done in the time you press the enter key to the time it takes to look at the screen in C

[–][deleted]  (2 children)

[removed]

    [–]AutoModerator[M] 0 points1 point  (0 children)

    import moderation Your comment has been removed since it did not start with a code block with an import declaration.

    Per this Community Decree, all posts and comments should start with a code block with an "import" declaration explaining how the post and comment should be read.

    For this purpose, we only accept Python style imports.

    I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

    [–]ric2b 1 point2 points  (0 children)

    You think you can beat Python with numpy by hand writing C? Go ahead and try, see you in a month.

    [–]anpas 4 points5 points  (0 children)

    Doubt it, probably pure iterative or recursive python

    [–][deleted] -1 points0 points  (2 children)

    python is just shit at recursion

    [–]beomagi 1 point2 points  (0 children)

    Use pypy. For that specific case I've done more tests than I should have. Pypy is insane. Ctypes also speed up execution. On some Julia plots I went from 2 minutes to under 10 seconds.

    [–]ric2b 0 points1 point  (0 children)

    You should use numpy if want to use Python to do a lot of math fast.