3 ms·
I agree except for the Python bit, which is factually wrong. Python allows you to program as if you’re a jazz pianist. You can improvise, iterate and have fun.
by lynguist 4y ago
I agree except for the Python bit, which is factually wrong.
Python allows you to program as if you’re a jazz pianist. You can improvise, iterate and have fun.
And when you found a solution you just refactor it and use numba. Boom, it runs the same speed as a compiled language.
I once wrote one little program that ran in 24 min without numba and ca. 8 seconds with numba.
- willis936 4y agoDozens of instances of a C GUI can launch in the time it takes to launch a hello world python program.
- lmm 4y agoBut who wants dozens of instances of a C GUI? I'd be the first to complain about latency where it maters, but launching a Python program is perceptually instant (and significantly lower-latency than many nominally "faster" languages, IME).
- geysersam 4y agoYes but what kind of comparison is that: 1. How often do you need to execute 1000 GUI instances? 2. How often do you need to print "hello world"? The right tool for the right job.
- willis936 4y agoThis is a discussion about computers being slow. As in a person asks a computer to do something and the human waits while the computer does it. So python isn't the right tool for any job that involves human interaction.
- geysersam 4y agoNah that's too general. A lot of website/app backends use Django or Fastapi and they work fine. Many more use PHP, also not a language famed for extreme performance. It depends on the application. Personally I wouldn't use Python for a GUI (because I'd use JS/TS).
- Nihilartikel 4y agoPython _is_ slow, but even back in 2006 on a pentium 4 I had no problem using it with PyGame to build a smooth 60fps rtype style shooter for a coding challenge. One just has to not do anything dumb in the render loop and it's plenty responsive. Of course, if you're going to interactively process a 50mb csv or something... But even then pandas is faster.
- Narishma 4y agoThat's because a Pentium 4 is way overkill for such a simple game.
- 323 4y agoThere is more to programming than iterating over number arrays, which is pretty much the only scenario where Numba shows impressive speedups.
- a-dub 4y agomost numerical algorithms are loops over arrays, accumulators and simple arithmetic. this is where numba shines. for the other cases, there's a python compatibility mode (on by default) that allows for use of arbitrary python. the hard parts in numba are ensuring type inference works correctly and adding it to existing python environments that might have dependencies pinned at inconvenient versions or other drama associated with adding an entire llvm to your python environment. also, there's the explosion of python versions cross numpy/mkl versions cross distributions cross bitwidths... but that's the nature of publicly shipping numerical code in python in general. all that said, when it's all set up, numba can be quite elegant and simpler than cython.