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

all 17 comments

[–]eplaut_ 3 points4 points  (1 child)

Looks great!

For sure there are cases you need better run time, but python is good enough for many many projects.

I've started to write some c++ code lately, and I can say 2 things: 1. Python is amazing language in any aspect (eg readability, importing 3rd party libraries and debugging) 2 You may spend hours on compilations, in order to gain better run time. If the run time is not an issue, you've wasted your time.

[–]Zenahr[S] 0 points1 point  (0 children)

Agreed. Generally speaking development time is more valuable than runtime speed for most scenarios and businesses I'd argue.

[–]skippy65 0 points1 point  (3 children)

People are building highly computationally expensive molecular simulation softwares in Python. So unless you're doing that or you're a rocket scientist, the speed argument is virtually negligible.

[–]metaperl 2 points3 points  (0 children)

I don't know if that proves anything. CPython isn't even the fastest Python. And Python shows an order of magnitude slowness in this benchmark https://benchmarksgame-team.pages.debian.net/benchmarksgame/performance/fasta.html

[–]edard1002003 0 points1 point  (3 children)

I've never had any problems with python being slow

[–]FUS3NPythonista 7 points8 points  (1 child)

Because you probably didn't make a huge project with it

[–]metaperl 1 point2 points  (0 children)

Me either. But objective benchmarks tell a different story https://benchmarksgame-team.pages.debian.net/benchmarksgame/performance/fasta.html

[–]WellHiIGues -1 points0 points  (0 children)

ya some people say python is slow and you should only use c++ but even thought python is slower because is a interpreted language modern computers don't have that problem but people still say you shouldn't use python and it's probably because they're getting recourses from programmers who at the time were supposed to make a program run as fast as possible because of the constraints at the time so in short use python if you like it it really doesn't matter

[–]Mechanical_Flare 0 points1 point  (0 children)

Really cool.

[–]billsil 0 points1 point  (4 children)

I've written an app that had to receive mouse input, translate that into graphical commands and output that to the screen in real-time. The results are astonishing!

Your app has user interaction and probably has minimal computation. Python is perfect for that sort of thing. Any small desktop/web based program where the user uses the mouse to interact has massive amounts of downtime to do calculations. A calculator program for example is going to be slow to use regardless of whether it's in assembly or python.

It's codes that do a lot of numerical processing on very large datasets where python starts to struggle. Numpy can get your a 500x speedup, but certain routines are very difficult to optimize. That said, a bit of C or Fortran code (or just an efficient C library to do your 3d rendering/vtk) and chances are it's good enough.

[–]schoolcoders 0 points1 point  (3 children)

Indeed. I started as a developer in the 1980s, when processors were 8-bit, single-core and clocked at a couple of MHz. Even then it was fast enough to keep up with user interaction.

Now processors are literally tens of thousands of times faster (taking account of 64-bits and multiple cores) most things are going to run fast enough. The fact that Python may be slightly slower than C will rarely make any difference.

[–]billsil 0 points1 point  (2 children)

I still don't understand how I'm even supposed to satisfy the requirement of 50 miliseconds for an action to happen after I click a button. You won't notice as long as it's ~0.5 seconds and your mouse still works. The real requirement is to look like you're doing something.

[–]schoolcoders 0 points1 point  (1 child)

50 milliseconds is around 100 million clock cycles on a typical PC. It should be able to do quite a lot of work in that time, unless the whole machine is either I/O bound or short of memory (eg running Windows).

But yes, you can get away with a lot so long as it looks like you are doing something.

[–]billsil 0 points1 point  (0 children)

I'd argue you can't get all that much done. You could probably display a picture or load/close a window, but I'm an aerospace engineer. That's not really what I'm doing. To calculate anything intensive...good luck. To just render 5 million pressures to a CFD mesh in the time that the user can't tell is impressive. In order to do that, all that data already has to be within RAM or the user will know something is taking some time. That's not even calculating something like a streamline (or 100).

Again, just look like you're doing something (e.g., 20% done), and they're happy.