News for hackers. Stuff that matters.
Re:The computers are fast, but you don't know it by lynguist on Thursday June 16, 2022 @04:10PM (#31770388)
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.

Re:The computers are fast, but you don't know it by 323 on Thursday June 16, 2022 @08:23PM (#31772637)
There is more to programming than iterating over number arrays, which is pretty much the only scenario where Numba shows impressive speedups.
Re:The computers are fast, but you don't know it by a-dub on Friday June 17, 2022 @02:08AM (#31774613)
most 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.

Re:The computers are fast, but you don't know it by willis936 on Thursday June 16, 2022 @04:17PM (#31770462)
Dozens of instances of a C GUI can launch in the time it takes to launch a hello world python program.
Re:The computers are fast, but you don't know it by geysersam on Thursday June 16, 2022 @04:50PM (#31770815)
Yes 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.

Re:The computers are fast, but you don't know it by willis936 on Thursday June 16, 2022 @05:17PM (#31771087)
This 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.

Re:The computers are fast, but you don't know it by Nihilartikel on Thursday June 16, 2022 @06:55PM (#31772026)
Python _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.

Re:The computers are fast, but you don't know it by Narishma on Friday June 17, 2022 @06:07AM (#31776127)
That's because a Pentium 4 is way overkill for such a simple game.
Re:The computers are fast, but you don't know it by geysersam on Thursday June 16, 2022 @05:47PM (#31771392)
Nah 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).

Re:The computers are fast, but you don't know it by lmm on Friday June 17, 2022 @01:30AM (#31774429)
But 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).