this post was submitted on 18 Oct 2026
478 points (99.0% liked)

Programmer Humor

33672 readers
1458 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 3 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] UnfortunateShort@lemmy.world 2 points 2 hours ago* (last edited 2 hours ago)

Tbf, it's not really like processors have 'DO JS STUFF' instructions, they are not made for one language or data format specifically of course. But ultimately, instructions are shaped by things people use.

JSON for example requires searching strings for structural characters: ,, {, } etc. Iirc you can use VPSHUFB ('Packed Shuffle Bytes' or so, AVX >=2) to map 32 bytes (or 64 on AVX-512 I guess) to any structural character in one instruction. That's quite the speedup compared to comparing all of them to all special characters one at a time, even considering SIMD kinda moves on its own pace. And it's exactly the kind of stuff you would use in your JS engine to make parsing JSON crazy fast, even when it's plain text, which is obviously less than ideal for a computer.

I remember there was some instruction that was introduced specifically because of something JS does all the time tought. I forgot what it was, maybe someone else can help out.