News for hackers. Stuff that matters.
Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by OulaX on Wednesday November 17, 2021 @12:00PM (#29255606)
Each programming language has its purpose.

C code is performant and that is a fact. Python code is not.

When building mission critical systems why don't programmers just use C itself instead of coding in another programming language and having it transpiled for them? Why introduce such tools all the time?

I am against this because the tools programmers use are becoming too bloated compared to 10-20 years ago.

Want to build an Android App? Use Java/Kotlin.

Want to build an iOS App? Use Swift.

Want to build a Web App? Use a Single JS Framework (Why millions of frameworks?)

Want to build a Windows Desktop App? Use C#.NET Either with WinForms or WPF.

I really see tools and technologies coming up all the time to solve a problem that most of the time doesn't exist.

Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by packetlost on Wednesday November 17, 2021 @12:22PM (#29255890)
You've never been near a lab environment clearly. Python is a dominant language in university labs and runs of lot more real-time systems than you think. Grad students rarely have industry experience and don't necessarily have the know-how to write C code effectively, so it's a question of resources and ecosystem. Numpy, matplotlib, pandas, scikit, TensorFlow, etc. are all huge draws for the scientific and ML communities.
Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by PaulDavisThe1st on Wednesday November 17, 2021 @06:22PM (#29260189)
> runs of lot more real-time systems than you think

soft real time systems, for sure. if it runs any hard real time systems, get out of the lab.

We could of course debate the boundary between hard and soft, but I'd rather not.

Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by packetlost on Wednesday November 17, 2021 @06:30PM (#29260271)
No, I mean nanosecond precision real-time systems. Exhibit A: https://github.com/m-labs/artiq

To save some reading, this uses a combination of an FPGA and kernel (which I think is in Rust) to generate a realtime buffer that is programmed using a mix of compiled-realtime python and plain python via a RPC system.

Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by ranger_danger on Wednesday November 17, 2021 @07:59PM (#29260915)
Python does not have nanosecond precision.
Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by nurettin on Thursday November 18, 2021 @06:51AM (#29264426)
3.7 has time.time_ns()
Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by PaulDavisThe1st on Thursday November 18, 2021 @01:12PM (#29268560)
"nanosecond precision" means that you can schedule something for a time in the future, and it will happen within 1 nsec of that time.
Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by packetlost on Friday November 19, 2021 @03:25PM (#29281933)
We are doing exactly that with Python and that system I linked.
Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by 4w4s on Wednesday November 17, 2021 @06:40PM (#29260359)
We can talk instead about how the requirements to run slightly less simple near-hard real-time controllers are really heavy in terms of money, effort and .. weight. This tool may actually help to streamline the software part, potentially being a substitution in certain cases to i.e. Matlab Coder or similar tools.
Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by zanellia on Thursday November 18, 2021 @02:40AM (#29263042)
Right, MATLAB Coder is a very related tool.
Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by zanellia on Wednesday November 17, 2021 @12:54PM (#29256377)
I think many people who have at least once first prototyped a numerical algorithm in a high-level language (say Python, Julia, MATLAB?) and then implemented it in C, can relate to the experience of transitioning from error messages of the type: "dimension mismatch for XYZ" to "segmentation fault". That's in my opinion a strong motivation to build tools that can automate certain parts of the development process.

Writing C code directly is as a good option, as long as your code is not too complex to develop, maintain and extend.

And, again, Python here is intended to be the host language for an embedded domain specific language that gets compiled into C. It does not need to be efficient it needs to be expressive and easy to analyse and transpile.

Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by adgjlsfhk1 on Wednesday November 17, 2021 @01:31PM (#29256916)
Note that the whole point of Julia is that it saves you the rewrite. There is Julia code running on top supercomputers that gives speed competitive to C/C++/Fortran. You will have to put in some work to get Julia code to be that fast, but it is usually dramatically easier than a rewrite in a different language.
Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by zanellia on Wednesday November 17, 2021 @03:50PM (#29258648)
It's not so easy deploy an algorithm written in Julia on an embedded platform though, is it?
Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by adgjlsfhk1 on Wednesday November 17, 2021 @05:45PM (#29259814)
Probably not :)
Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by fault1 on Wednesday November 17, 2021 @01:44PM (#29257117)
yes, but "speed" in 'top supercomputers' is not "speed" in 'embedded systems'.

I do think Julia potentially can crack this space, but the runtime at least historically has not been tailored for it.

It does seem like Julia has become more modular lately especially being able to disconnect the JIT (or LLVM ORC). H Hopefully you'll either being able to either defatten or completely remove the runtime dependencies (ala Rust in no-std mode). Each of these is important for different use cases.

Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by klyrs on Wednesday November 17, 2021 @12:04PM (#29255655)
The problem that this language solves is that it automatically sorts out the memory usage for you. That isn't a problem for me; I've been programming in C for decades. But it is a problem for most python programmers who don't have a lick of C experience, but want to get C performance. It drastically lowers the barrier of entry.
Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by zanellia on Wednesday November 17, 2021 @01:19PM (#29256723)
For what it counts, I have developed code for this kind of applications exclusively in C for ~5 years (let's say 20% of my working time). I still think that debugging a segfault that you could have avoided is not very productive and that motivated me to look into possible alternatives.
Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by klyrs on Wednesday November 17, 2021 @03:03PM (#29258180)
FWIW, I almost always use valgrind before a debugger, when tracking down segfaults. It doesn't catch everything, but 90% of the time, it gets me to the right region of code in a single run.
Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by zanellia on Wednesday November 17, 2021 @03:35PM (#29258504)
sure I use valgrind and gdb too - still hard to argue that a segfault is pleasant to debug though?
Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by klyrs on Wednesday November 17, 2021 @04:10PM (#29258887)
Good good, just wanted to advocate for my favorite tool there. But, in my experience, segfaults are usually the easiest bugs to resolve. Unlike a sign error in my math, they're impossible to miss!

That said, tooling to get rid of them entirely is not to be sneezed at :)

Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by kevin_thibedeau on Wednesday November 17, 2021 @02:49PM (#29258019)
99% of the time a stack trace shows the culprit for a segfault straight away. No different than debugging Python.
Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by zanellia on Wednesday November 17, 2021 @03:37PM (#29258520)
if we are arguing that implementing a numerical algorithm in C is as easy as implementing it in Python - I would disagree. But maybe I am just wrong :)
Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by kevin_thibedeau on Wednesday November 17, 2021 @06:17PM (#29260144)
The issue is debugging crashes, not productivity.
Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by GekkePrutser on Wednesday November 17, 2021 @12:17PM (#29255833)
Yes and it will also prevent common memory management bugs that can lead to code injection.
Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by GekkePrutser on Wednesday November 17, 2021 @12:16PM (#29255813)
It doesn't have to be production. Maybe it's for a research project where you just need the extra performance.

Everything has a cost. This may not be ideal but learning to do C properly as an experienced Python dev will have a time cost as well. This may just be the best way to get from A to B.

I remember when I did a one-off project with a PIC microcontroller. I only had an assembler and I spent 2 days getting nowhere.

Then i found a C compiler and I had the whole thing running in 2 hours. The compiler turned out to much more efficient in speed as well as code size than my hand-written assembler.

Re:Show HN: Prometeo – a Python-to-C transpiler for high-per... by Zababa on Wednesday November 17, 2021 @12:29PM (#29256014)
> When building mission critical systems why don't programmers just use C itself instead of coding in another programming language and having it transpiled for them?

Why C and not assembler?

> Why introduce such tools all the time?

C compilers are one of those tools.