logoalt Hacker News

prisencolast Friday at 8:07 PM13 repliesview on HN

My question is why use AI to output javascript or python?

Why not output everything in C and ASM for 500x performance? Why use high level languages meant to be easier for humans? Why not go right to the metal?

If anyone's ever tried this, it's clear why: AI is terrible at C and ASM. But that cuts into what AI is at its core: It's not actual programming, it's mechanical reproduction.

Which means its incapabilities in C and ASM don't disappear when using it for higher-level languages. They're still there, just temporarily smoothed over due to larger datasets.


Replies

headcanonlast Friday at 8:28 PM

One thing I have been doing is breaking out of my long-held default mode of spinning up a react/nextjs project whenever I need frontend, and generating barebones HTML/CSS/JS for basic web apps. A lot of the reason we went with the former was the easy access to packages and easy-to-understand state management, but now that a lot of the functionality packages used to provide can be just as easily generated, I can get a lot more functionality while keeping dependencies minimal.

I haven't tried C or ASM yet, but it has been working very well with a C++ project I've been working on, and I'm sure it would do reasonably well with bare-bones C as well.

I'd be willing to bet it would struggle more with a lower-level language initially, but give it a solid set of guardrails with a testing/eval infrastructure and it'll get its way to what you want.

show 3 replies
tverbeureyesterday at 3:46 AM

The premise of your question is wrong. I would still write Python for most of my tasks even if I were just as fast at writing C or ASM.

Because the conciseness and readability of the code that I use is way more important than execution speed 99% of the time.

I assume that people who use AI tools still want to be able to make manual changes. There are hardly any all or nothing paradigms in the tech world, why do you assume that AI is different?

show 1 reply
simonwyesterday at 1:14 PM

They've got good at C now. I can't speak for ASM.

Here's a C session that I found quite eye-opening the other day: https://gisthost.github.io/?1bf98596a83ff29b15a2f4790d71c41d...

nlyesterday at 11:45 AM

I had it write a new stdlib implementation (wasm<->JS) for a custom web based fantasy console I'm writing.

It did ok at that.

We'll - Doom runs so ok enough for what I wanted anyway.

No, it's not a copy of other WASM stdlib implementations.

Leynosyesterday at 7:05 PM

I pretty much do most of my AI coding in Rust. Although I do still use Python or Typescript where appropriate.

mrocklinyesterday at 3:10 AM

If you read on in the post you might be interested in the section titled

Drop Python: Use Rust and Typescript

https://matthewrocklin.com/ai-zealotry/#big-idea-drop-python...

danielmarkbrucelast Friday at 8:32 PM

It cuts to training data and effort. A lot of effort has been put in to optimize for python, even down to tokenization.

lynx97last Friday at 8:43 PM

My small-program success story with genAI coding is pretty much the opposite of your claim. I used to use a bash script with a few sox instances piped into each other to beat-match and mix a few tracks. Couldn't use a GUI... Then came gpt-5, and I wanted to test it anyway. So I had it write a single-file C++ program that does the track database, offline mixing, limiter and a small REPL-based "UI" to control the thing. I basically had results before my partner was finished preparing breakfast. Then I had a lot of fun bikeshedding the resulting code until it felt like something I'd like to read. Some back and forth, pretending to have an intern and just reviewing/fixing their code. During the whole experience, it basically never generated code which wouldn't compile. Had a single segfault which was due to unclear interface to a C library. Got that fixed quickly.

And now, I have a tool to do a (shuffled if I want) beat-matched mix of all the tracks in my db which match a certain tag expression. "(dnb | jungle) & vocals", wait a few minutes, and play a 2 hour beat-matched mix, finally replacing mpd's "crossfade" feature. I have a lot of joy using that tool, and it was definitely fun having it made. clmix[1] is now something I almost use daily to generate club-style mixes to listen to at home.

[1] https://github.com/mlang/clmix

kermattyesterday at 4:38 AM

Isn't it also because LLMs are trained on existing software, and the programs we would write in Python or JS have few examples in C ?

show 1 reply
sphyesterday at 11:33 AM

I don't get this. AI coders keep saying they review all the code they push, and your suggestion is to use even harder languages the average vibe coder is unable to understand, all in name of "performance"? Faster code maybe, and exponentially increasing the tech debt and amount of bugs that slips through.

It wasn't even long ago that we thought developer experience and capacity for abstraction (which is easier to achieve in higher level languages) was paramount.

show 1 reply
wiseowiseyesterday at 8:29 AM

Because you want to modify those later instead of having read only blob?

show 1 reply
bfleschlast Friday at 8:33 PM

That's a very good example.