News for hackers. Stuff that matters.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by rented_mule on Friday March 20, 2026 @08:03PM (#47462536)
Something not unlike this happened to me when moving some batch processing code from C++ to Python 1.4 (this was 1997). The batch started finishing about 10x faster. We refused to believe it at first and started looking to make sure the work was actually being done. It was.

The port had been done in a weekend just to see if we could use Python in production. The C++ code had taken a few months to write. The port was pretty direct, function for function. It was even line for line where language and library differences didn't offer an easier way.

A couple of us worked together for a day to find the reason for the speedup. Just looking at the code didn't give us any clues, so we started profiling both versions. We found out that the port had accidentally fixed a previously unknown bug in some code that built and compared cache keys. After identifying the small misbehaving function, we had to study the C++ code pretty hard to even understand what the problem was. I don't remember the exact nature of the bug, but I do remember thinking that particular type of bug would be hard to express in Python, and that's exactly why it was accidentally fixed.

We immediately started moving the rest of our back end to Python. Most things were slower, but not by much because most of our back end was i/o bound. We soon found out that we could make algorithmic improvements so much more quickly, so a lot of the slowest things got a lot faster than they had ever been. And, most importantly, we (the software developers) got quite a bit faster.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by envguard on Friday March 20, 2026 @08:28PM (#47462729)
Agreed — the headline buries the lede. Algorithmic complexity improvements compound across all future inputs regardless of implementation language, while the WASM boundary win is more of a one-time gain. Worth noting that the statement-level caching insight generalises well: many parser-adjacent hot paths suffer the same O(N²) trap when doing repeated prefix/suffix matching without memoisation.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by sincerely on Saturday March 21, 2026 @05:07AM (#47465373)
AI account
[dead]
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by Aurornis on Friday March 20, 2026 @11:37PM (#47463748)
This comment comes from a bot account. One of the more clever ones I’ve seen that avoids some of the usual tells, but the comment history taken together exposes it.

I hit the flag button on the comment and suggest others do too.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by DaleBiagio on Monday March 23, 2026 @03:37PM (#47494126)
Huh? How am I a bot account?
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by furyofantares on Friday March 20, 2026 @11:18PM (#47463675)
Thanks, Programming History Facts Bot

I was not actually sure this one was a bot, despite LLM-isms and, sadly, being new. But you can look at the comment history and see.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by DaleBiagio on Monday March 23, 2026 @03:38PM (#47494130)
Definitely not a bot, I am however super interested in programming history!
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by samiv on Friday March 20, 2026 @11:09PM (#47463630)
Until at some point in a language like python all the things that allowed you write software faster start to slow you down like the lack of static typing and typing errors and spending time figuring out whether foo method works with ducks or quacks or foovars or whether the latest refactoring actually silently broke it because now you need bazzes instead of ducks. Yeah.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by apitman on Friday March 20, 2026 @10:06PM (#47463341)
I don't think the better software part is playing out
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by ch4s3 on Friday March 20, 2026 @10:33PM (#47463473)
There’s a lot of really great software out there right now, and a lot that’s terrible and I think powerful abstractions enable both.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by remexre on Friday March 20, 2026 @10:36PM (#47463484)
you're thinking of the programs in low-level langs that survived their higher-level-lang competitors; if you plot the programs on your machine by age, how does the low quartile compare on reliability between programs written in each group
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by DaleBiagio on Monday March 23, 2026 @03:43PM (#47494199)
Survivorship bias is exactly right.

The C and assembly programs we still use are the ones that were good enough to last. The thousands that weren't are gone.

Nobody counts the programs that were never finished because the language made them too hard to write in the first place.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by asa400 on Friday March 20, 2026 @08:30PM (#47462749)
Fun story! Performance is often highly unintuitive, and even counterintuitive (e.g. going from C++ to Python). Very much an art as well as a science.

Crazy how many stories like this I’ve heard of how doing performance work helped people uncover bugs and/or hidden assumptions about their systems.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by staticassertion on Saturday March 21, 2026 @01:53AM (#47464351)
It doesn't come off as unintuitive by my read. They had a bug that led to a massive performance regression. Rewriting the code didn't have that bug so it led to a performance improvement.

They found that they had fewer bugs in Python so they continued with it.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by harpiaharpyja on Saturday March 21, 2026 @03:52AM (#47464947)
I think a lot of people (especially those who are only peripherally involved in development, like management) don't really consider performance regressions at all when thinking about how to get software to go faster.

Meanwhile my experience has been that whenever there has been a performance issue severe enough to actually matter, it's often been the result of some kind of performance bug, not so much language, runtime, or even algorithm choices for that matter.

Hence whenever the topic of how to improve performance comes up, I always, always insist that we profile first.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by staticassertion on Saturday March 21, 2026 @03:56AM (#47464962)
My experience has been that performance bugs show up in lots of places and I'm very lucky when it's just a bug. The far more painful performance issues are language and runtime limitations.

But, of course, profiling is always step one.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by asveikau on Friday March 20, 2026 @09:12PM (#47463010)
> After identifying the small misbehaving function, we had to study the C++ code pretty hard to even understand what the problem was. I don't remember the exact nature of the bug, but I do remember thinking that particular type of bug would be hard to express in Python, and that's exactly why it was accidentally fixed.

Pure speculation, but I would guess this has something to do with a copy constructor getting invoked in a place you wouldn't guess, that ends up in a critical path.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by andrewflnr on Friday March 20, 2026 @10:01PM (#47463318)
Given the context, I'm thinking bad cache keys resulting in spurious cache misses, where the keys are built in some low-level way. Cache misses almost certainly have a bigger asymptotic impact than extra copies, unless that copy constructor is really heavy.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by asveikau on Friday March 20, 2026 @10:07PM (#47463348)
I'm just remembering a performance issue I heard of eons ago where a sorting function comparison callback inadvertently allocated memory. It made sorting very slow. Someone said in a meeting that sorting was slow, and we all had a laugh about "shouldn't have used the bubble sort!" But it was the key comparison doing something stupid.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by NooneAtAll3 on Friday March 20, 2026 @09:15PM (#47463039)
good ol' shallow-vs-deep copy
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by branko_d on Saturday March 21, 2026 @07:54AM (#47466211)
My guess would be bad hashing, resulting in too many collisions.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by ameixaseca on Saturday March 21, 2026 @12:16AM (#47463923)
My experience is the exact opposite.

This was particularly true for one of the projects I've worked with in the past, where Python was chosen as the main language for a monitoring service.

In short, it proved itself to be a disaster: just the Python process collecting and parsing the metrics of all programs consumed 30-40% of the processing power of the lower end boxes.

In the end, the project went ahead for a while more, and we had to do all sorts of mitigations to get the performance impact to be less of an issue.

We did consider replacing it all by a few open source tools written in C and some glue code, the initial prototype used few MBs instead of dozens (or even hundreds) of MBs of memory, while barely registering any CPU load, but in the end it was deemed a waste of time when the whole project was terminated.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by serial_dev on Saturday March 21, 2026 @02:32AM (#47464512)
Another anecdote, the team couldn’t improve concurrency reliably in Python, they rewrote the service in about a month (ten years ago) in Go, everything ran about 20x faster.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by wiseowise on Saturday March 21, 2026 @04:05AM (#47465029)
> but in the end it was deemed a waste of time when the whole project was terminated.

The main lesson of the story. Just pick Python and move fast, kids. It doesn’t matter how fast your software is if nobody uses it.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by stephantul on Saturday March 21, 2026 @04:27AM (#47465143)
This is it. Getting something on the table for stakeholders to look at trumps anything else.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by ameixaseca on Saturday March 21, 2026 @11:41AM (#47468020)
It would have taken the same time, if not less, given the extra time for mitigations, trying different optimization techniques, runtimes, etc.

One of the reasons the project was killed was that we couldn't port it to our line of low powered devices without a full rewrite in C.

Please note this was more than a decade ago, way before Rust was the language it was today. I wouldn't chose anything else besides Rust today since it gives the best of both worlds: a truly high level language with low level resource controls.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by littlestymaar on Saturday March 21, 2026 @06:03AM (#47465681)
And this is why pretty much all commercial software is terrible and runs slower than the equivalent 20 years ago despite incredible advance in hardware.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by philipallstar on Saturday March 21, 2026 @12:56PM (#47468782)
For lots of software there wasn't an equivalent 20 years ago because there wasn't a language that would let developers explore semi-specified domains fast enough to create something useful. Unless it was visual basic, but we can't use that, because what would all the UX people be for?
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by littlestymaar on Monday March 23, 2026 @02:26PM (#47493290)
Python itself is 30 years old. What are you talking about?

Almost every mainstream languages (except Go, Swift, Kotlin and Rust) are more than 30 years old, by the way.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by Aeolun on Saturday March 21, 2026 @07:09AM (#47465973)
You can use Go and get the best of both worlds.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by nickserv on Saturday March 21, 2026 @09:10AM (#47466693)
One of the slowest, most ineficient code bases I've ever worked on was in Go.

The mentality was "the language is fast, so as long as it compiles we're good"... Yeah that worked out about as well as you'd expect.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by zeroc8 on Saturday March 21, 2026 @11:40AM (#47468003)
But that has nothing to do with the language.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by nickserv on Saturday March 21, 2026 @03:53PM (#47470639)
Absolutely, and it's a good language when used properly. This was more of a problem with the hype surrounding it.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by lowbloodsugar on Saturday March 21, 2026 @11:43AM (#47468036)
I would agree except for the python part. Sure, you gotta move fast, but if you survive a year you still gotta move fast, and I’ve never seen a python code base that was still coherent after a year. Expert pythonistas will claim, truthfully, that they have such a code base but the same can be said of expert rustaceans. I would stick to typescript or even Java. It will still be a shitshow after a year but not quite as fucked as python.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by miki123211 on Saturday March 21, 2026 @12:03PM (#47468240)
https://github.com/polarsource/polar/tree/main/server

If you're writing FastAPI (and you should be if you're doing a greenfield REST API project in Python in 2026), just s/copy/steal/ what those guys are doing and you'll be fine.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by Someone on Saturday March 21, 2026 @02:47PM (#47469999)
> Just pick Python and move fast, kids. It doesn’t matter how fast your software is if nobody uses it.

The reason nobody uses your software could be that it is too slow. As an example, if you write a video encoder or decoder, using pure Python might work for postage-stamp sized video because today’s hardware is insanely fast, but even, it likely will be easier to get the same speed in a language that’s better suited to the task.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by wiseowise on Saturday March 21, 2026 @02:59PM (#47470118)
Learning that it’s too slow takes users.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by casey2 on Saturday March 21, 2026 @08:53PM (#47473228)
They were the users and it was too slow for them so they switched to python. Not C++ of course, what they meant was "the libraries we wrote in C++ were too buggy and slow that using them was slower than if we just used Python."
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by Someone on Sunday March 22, 2026 @03:18AM (#47475215)
In some cases, common sense of developers can do that, too.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by bjoli on Saturday March 21, 2026 @04:37PM (#47471039)
if input() == "dynamic scope?": defined = "happyhappy" print(defined)

I'd rather not use python. The ick gets me every time.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by bjoli on Sunday March 22, 2026 @02:29AM (#47474996)
It killed ny formatting

    if input() == "dynamic scope?":
        defined = "happyhappy"
    print(defined)
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by rurban on Sunday March 22, 2026 @03:58AM (#47475382)
Terrible advice. Really.

Most the the business I do is rewriting old working python prototypes to C++. Python sucks, is slow and leaks. The new C++ code does not leak, meets our performance requirements, processes items instead of 36 hour in 8 hours, and such.

We are also rewriting all the old python UI in typescript. That went not so easy yet.

And when there are still old simple python helpers, I rewrite them into perl, because this will continue to run in the next years, unlike python.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by czhu12 on Saturday March 21, 2026 @06:34AM (#47465823)
Ditto for me. I had gotten so used to building web backends in Ruby and running at 700MB minimum. When I finally got around to writing a rust backend, it registered in the metrics as 0MB, so I thought for sure the application had crashed.

Turns out the metrics just rounded to the nearest 5MB

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by naasking on Saturday March 21, 2026 @08:42AM (#47466509)
> just the Python process collecting and parsing the metrics of all programs consumed 30-40% of the processing power of the lower end boxes.

Just write the parsing loop in something faster like C or Rust, instead of the whole thing.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by Traubenfuchs on Saturday March 21, 2026 @10:24AM (#47467311)
He struggled with the algorithms, you struggled with the runtime.

You are not the same.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by tda on Saturday March 21, 2026 @02:17AM (#47464451)
Ome advantage of python is that it is so slow that if you choose the wrong algorithm or data structure that soon gets obvious. And for complicated stuff this is exactly where I find the LLMs struggle. So I make a first version in Python, and only when I am happy with the results and the speed feels reasonable compared to the problem complexity, I ask Claude Code to port the critical parts to Rust.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by rabisg on Saturday March 21, 2026 @02:51AM (#47464599)
The last part is really interesting. It feels like the whole world will soon become Python/JS because thats what LLMs are good at. Very few people will then take the pain of optimizing it
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by eru on Saturday March 21, 2026 @05:11AM (#47465403)
The LLMs are pretty good at optimising.

Not because they are brilliant, but because they are pretty good at throwing pretty much all known techniques at a problem. And they also don't tire of profiling and running experiments.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by elcritch on Saturday March 21, 2026 @06:00AM (#47465671)
Not just profiling, but decoding protocols too.

Recently I tried Codex/GPT5 with updating a bluetooth library for batteries and it was able to start capturing bluetooth packets and comparing them with the libraries other models. It was indefatigable. I didn't even know if was so easy to capture BLE packets.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by anthk on Saturday March 21, 2026 @07:57AM (#47466240)
Wireshark would do that. But you need to understand low level tools because in case on some BGP attack you all LLM developers will be fired in the spot.

Flakey internet connection: most of current 'soy devs' would be useless. Even more with boosted up chatbots.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by eru on Sunday March 22, 2026 @12:37AM (#47474517)
> Flakey internet connection: most of current 'soy devs' would be useless.

We used to make the same jokes about Googling Stackoverflow since before many users on this site were born.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by anthk on Sunday March 22, 2026 @05:49AM (#47475908)
And it's partially true. Offline documentation should be mandatory everywhere. Networks can be degraded tomorrow in the current 2nd Cold War we are living. And, yes, the states and goverments have private backbones for the military/academia/healthcare and so on, but the rest it's screwed.

When the blackout the only protocols which worked fine where IRC, Gopher and Gemini. I could resort to using IRC->Bitlbee to chat against different people of the world, read news and proxy web sites over Gemini (the proto, not the shitty AI). But, for the rest, the average folk? half an our to fetch a non-working page.

That with a newspaper, go figure with the rest. And today tons of projects use sites with tons of JS and unnecesary trackers and data. In case of a small BGP attack, most projects done with LLM's will be damned. Because they won't even have experience on coding without LLM's. Without docs it's game over.

Also tons of languages pull dependencies. Linux distros with tons of DVD's can survive offline with Python, but good luck deploying NPM, Python and the rest projects to different OSes. If you are lucky you can resort to the bundled Go dependencies in Debian and cross compile, and the same with MinGW cross compiling against Windows with some Win32, SDL, DX support but that's it.

With QT Creator and MinGW, well, yes, you could build something reliable enough -being cross platform- and with Lazarus/Free Pascal, but forget about current projects downloading 20000 dependencies.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by elcritch on Sunday March 22, 2026 @08:42PM (#47484045)
Heh, my preferred language is Nim which has good docs for the stdlib. It also does static binaries and runs on esp32 like a dream. I’m not worried about some internet downtime, but I also enjoy what I can guide LLMs to build for me.

The BLE battery syncing was a nice-to-have for an IoT prototype. Not something I wanted to spend hours digging through wireshark to figure out but fine for some LLM hacking.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by eru on Monday March 23, 2026 @12:27AM (#47485493)
> Offline documentation should be mandatory everywhere. Networks can be degraded tomorrow in the current 2nd Cold War we are living.

Eh? It's all about trade-offs. If our infrastructure is degraded enough that the internet goes down, I have more important things to do than work through a few more Jira tickets.

Especially since a lot of the work me and a lot of other folks are doing is delivered to customers via the internet anyway.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by eru on Sunday March 22, 2026 @04:30AM (#47475537)
Could you ask the LLM to do a write-up on the process and post it? (Or you can write a blog post by hand. Like a caveman. ;)
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by elcritch on Sunday March 22, 2026 @08:31PM (#47483963)
I find writing by hand is the best. LLMs spit out such linked-in writing that I don’t even want to read it. ;)

But that would be a good blog post and I got some travel coming up. But honestly it was just “oh here’s a BLE python library, see if we can get it running”. I prefer Codex because it seems to do well for guiding the LLMs for complete engineering changes.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by mirsadm on Saturday March 21, 2026 @09:40AM (#47466940)
Not in my experience. They're pretty good at getting average performance which is often better than most programmers seem to be willing to aim for.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by eru on Sunday March 22, 2026 @01:59AM (#47474867)
What kind of 'average' is this, if it's better than what seems to be typical?
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by miki123211 on Saturday March 21, 2026 @12:09PM (#47468300)
If there's one thing LLMs are really, really good at, it's having a target and then hitting / improving upon that target.

If you have a comprehensive test suite or a realistic benchmark, saying "make tests pass" or "make benchmark go up" works wonders.

LLMs are really good at knowing patterns, we still need programmers to know which pattern to apply when. We'll soon reach a point where you'll be able to say "X is slow, do autoresearch on X" and X will just magically get faster.

The reason we can't yet isn't because LLMs are stupid, it's because autoresearch is a relatively new (last month or so) concept and hasn't yet entered into LLM pretraining corpora. LLMs can already do this, you just need to be a little bit more explicit in explaining exactly what you need them to do.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by philipallstar on Saturday March 21, 2026 @01:47PM (#47469357)
I've not tried this yet, but doesn't it use up loads of tokens? How do you do it efficiently?
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by eru on Sunday March 22, 2026 @12:40AM (#47474529)
It uses a lot of minutes on your computer(s), since you need to run lots and lots of experiments.

I'm not sure if it's particularly token hungry.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by eru on Sunday March 22, 2026 @12:41AM (#47474534)
> The reason we can't yet isn't because LLMs are stupid, it's because autoresearch is a relatively new (last month or so) concept [...]

I'm not so sure. People have been doing stuff like (hyper) parameter search for ages. And profiling and trying out lots of things systematically has been the go-to approach for performance optimisation since forever; making an LLM instead of a human do that is the obvious thing to try?

The concept of 'autoresearch' might bring with it some interesting and useful new wrinkles, but on a fundamental level it's not rocket science.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by 9rx on Saturday March 21, 2026 @09:35AM (#47466906)
> JS because thats what LLMs are good at.

That has not been my experience. JS/TS requires the most hand-holding, by far. LLMs are no doubt assumed to be good at JS due to the sheer amount of training data, but a lot of those inputs are of really poor quality, and even among the high quality inputs there isn't a whole lot of consistency in how they are written. That seems to trip up the LLMs. If anything, LLMs might finally be what breaks the JS camel's back. Although browser dominance still makes that unlikely.

> Very few people will then take the pain of optimizing it

Today's LLMs rarely take the initiative to write benchmarks, but if you ask it will and then will iterate on optimizing using the benchmark results as feedback. It works fairly well. There is a conceivable near future where LLMs or LLM tools will start doing this automatically.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by rabisg on Saturday March 21, 2026 @11:16AM (#47467803)
My experience is from trying to get the React Native example to work with OpenUI. Felt Sonnet/Opus was much better at figuring out whats wrong with the current React implementation and fixing it than it was with React Native

But yes I see what you mean and I think people are trying to solve it with skills and harnesses at the application layer but its not there yet

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by deterministic on Monday March 23, 2026 @08:23PM (#47497071)
Nope. The world runs on code written in C and C++. Including Python itself. There is a reason why there are literally millions of C/C++ programmers out there working on C/C++ code every day.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by shevy-java on Saturday March 21, 2026 @04:31AM (#47465168)
> We immediately started moving the rest of our back end to Python. Most things were slower, but not by much because most of our back end was i/o bound.

Would be kind of cool if e. g. python or ruby could be as fast as C or C++.

I wonder if this could be possible, assuming we could modify both to achieve that as outcome. But without having a language that would be like C or C++. Right now there is a strange divide between "scripting" languages and compiled ones.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by nubg on Saturday March 21, 2026 @08:02AM (#47466262)
@dang this is an ai slop account, check his other comments
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by peter_retief on Saturday March 21, 2026 @04:42AM (#47465232)
I suspect that you used highly optimized algorithms written for python, like the vector algorithms in numpy? You will struggle to write better code, at least I would.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by masklinn on Saturday March 21, 2026 @04:59AM (#47465327)
Python 1.4 would be mid-late 90s long before numpy and vector algorithms would have been available.

I suspect it’s more likely to be something like passing std::string by value not realising that would copy the string every time, especially with the statement that the mistake would be hard to express in Python.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by johnisgood on Saturday March 21, 2026 @05:57AM (#47465656)
Everything is new to the uninitiated. :P
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by WalterBright on Saturday March 21, 2026 @11:50AM (#47468117)
> We soon found out that we could make algorithmic improvements so much more quickly

It's true that writing code in C doesn't automatically make it faster.

For example, string manipulation. 0-terminated strings (the default in C) are, frankly, an abomination. String processing code is a tangle of strlen, strcpy, strncpy, strcat, all of which require repeated passes over the string looking for the 0. (Even worse, reloading the string into the cache just to find its length makes things even slower.)

Worse is the problem that, in order to slice a string, you have to malloc some memory and copy the string. And then carefully manage the lifetime of that slice.

The fix is simple - use length-delimited strings. D relies on them to great effect. You can do them in C, but you get no succor from the language. I've proposed a simple enhancement for C to make them work https://www.digitalmars.com/articles/C-biggest-mistake.html but nobody in the C world has any interest in it (which baffles me, it is so simple!).

Another source of slowdown in C is I've discovered over the years that C is not a plastic language, it is a brittle one. The first algorithm you select for a C project gets so welded into it that it cannot be changed without great difficulty. (And we all know that algorithms are the key to speed, not coding details.) Why isn't C plastic?

It's because one cannot switch back and forth between a reference type and a value type without extensively rewriting every use of it. For example:

    struct S { int a; }
    int foo(struct S s) { return s.a; }
    int bar(struct S *s) { return s->a; }
If you want to switch between reference and value, you've got to go through all your code swapping . and ->. It's just too tedious and never happens. In D:

    struct S { int a; }
    int foo(S s) { return s.a; }
    int bar(S *s) { return s.a; }
I discovered while working on D that there is no reason for the C and C++ -> operator to even exist, the . operator covers both bases!
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by garaetjjte on Saturday March 21, 2026 @10:18PM (#47473798)
Well clearly there is use for these - how do you distinguish what you are accessing in smart-pointer-like types.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by WalterBright on Sunday March 22, 2026 @12:16AM (#47474396)
You'd still use the "." operator. Value, reference, or smart pointer use the same syntax. This means you can refactor them easily.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by rented_mule on Monday March 23, 2026 @06:55AM (#47487683)
What an honor to have Walter Bright respond to my comment! I used Zortech C++ extensively in the late 1980s and early 1990s on OS/2 and Windows. That beautiful black and purple cube-shaped box sat prominently on my bookshelf for many years. Thanks Walter!
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by zeroonetwothree on Saturday March 21, 2026 @12:44PM (#47468650)
I ported Python to C++ one time and it ran 10c faster with 10x less memory usage with no architectural changes
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by casey2 on Saturday March 21, 2026 @08:48PM (#47473189)
This is the difference between scripting and programming. If you use C++ as a scripting language you're gonna have a bad time.Of course a scripting language is faster for scripting! That doesn't mean you go full Graham and throw away real programming languages, it just means you aren't writing systems software.

The usual strategy is to write a script then if it's slow see how you could design a program that would

The usual strategy in the real world is to copy paste thousands of lines of C++ code until someone comes along and writes a proper direct solution to the problem.

Of course there are ideas on how to fix this, either writing your own scripting libraries (stb), packages (go/rust/ts), metaprogramming (lisp/jai). As for bugs those are a function of how you choose to write code, the standard way of writing shell it bug prone, the standard way of writing python is less so, not using overloading & going wider in c++ generally helps.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by deterministic on Monday March 23, 2026 @08:25PM (#47497086)
I use C++ instead of so called 'scripting' languages all the time. I have zero problems doing that and it is lightning fast.