B
bitsnbites
bitsnbites.eu · Personal blog · on HN since 2011
bitsnbites is a developer who writes about CPU design, instruction set density, benchmarks, SIMD, and compression, including his MRISC32 CPU.
What HN saysHN links him in CISC vs RISC code density debates, though one commenter says his static-count metric is flawed. Others cite his OS benchmarks and JavaScript compression.
25HN people shared it
14linked it in comments
18stories submitted
445story points
9 months agolast shared
2011people per year2026
Most-shared posts
- 1Benchmarking OS primitives7 people · 73 points · first shared 2018 · 52 comments on HN
- 2Debunking CISC vs. RISC code density (2022)5 people · 4 points · first shared 2022 · 1 comments on HN
- 3Fundamental flaws of SIMD ISAs (2021)3 people · 210 points · first shared 2021 · 144 comments on HN
- 4The MRISC32 – A vector first CPU design2 people · 87 points · first shared 2018 · 18 comments on HN
- 5Compression of JavaScript programs2 people · 23 points · first shared 2011 · 6 comments on HN
- 6A tidy, linear Git history1 people · 22 points · first shared 2015 · 8 comments on HN
- 7Muon Baryon, an HTML5/WebGL demo in 6k JavaScript1 people · 12 points · first shared 2011 · 3 comments on HN
- 8Doing a sound synth in JavaScript1 people · 6 points · first shared 2014 · discussion on HN
- 9Faster C++ builds – Bits'n'Bites1 people · 3 points · first shared 2018 · discussion on HN
- 10Show HN: A luma dependent chroma compression algorithm (image compression)1 people · 1 points · first shared 2026 · discussion on HN
- 11IEEE 754 suggestion: A “core” subset1 people · 1 points · first shared 2020 · discussion on HN
- 12Let’s make some music – online [HTML5 music tracker]1 people · 1 points · first shared 2011 · discussion on HN
- 13MRISC32 – Stabilizing the Base Architecture1 people · 1 points · first shared 2021 · discussion on HN
- 14Denser machine code than C++ code (compiler optimizations)1 people · 1 points · first shared 2021 · discussion on HN
- 15A tidy linear git history1 people · first shared 2017
What HN people wrote when they linked it
adgjlsfhk1 · 2025-03-27
> The first Google result I found agrees: https://www.bitsnbites.eu/cisc-vs-risc-code-density/
This isn't a great metric for 2 reasons. Firstly, it's looking at static rather than dynamic instruction counts, and 2nd x86 tends to get bigger vectorized implimentations, but these are often on bigger vectors so the "instructions per data" which is the more important metric in many cases is lower.
https://news.ycombinator.com/item?id=19329128 has a pretty interesting discussion on this from a few years ago, but 2 places where x86 shines are the lea and mov instructions. They are both incredibly compact for representing potentially very complicated operations.
kllrnohj · 2022-03-01
Very true (hence "most" not "all" in my statement :) ), but with AV disabled it's more or less on par with MacOS: https://www.bitsnbites.eu/benchmarking-os-primitives/ (not the best comparison given the wide variety of hardware in play, but for orders of magnitude it's probably good enough)
File creation on Windows is similarly massively impacted by search & AV.
sedachv · 2018-06-09
Great observation. And in fact "serverless" is the way that Unix network servers used to work: https://en.wikipedia.org/wiki/Inetd
CGI is also the way the web used to work. Spawning processes has only gotten faster since then. The entire "process spawning doesn't scale to the modern web" argument is completely and totally bogus. Today, spawning a process in Linux is only 10-20 microseconds slower than creating a thread: http://www.bitsnbites.eu/benchmarking-os-primitives/
The performance problems are elsewhere.
adam-a · 2012-04-26
You get a nice surprise if you view source too. The demo uses a png to compress the javascript, more details on the author's blog http://www.bitsnbites.eu/?p=20#better_png
IshKebab · 2025-03-26
> it also gives us better density overall by having smaller instructions. x86 can put more work into each instruction byte, so we can have denser binaries and increase performance that way.
Is that really true? I was under the impression that ARM core density was better than x86.
The first Google result I found agrees: https://www.bitsnbites.eu/cisc-vs-risc-code-density/
> It may take a little bit more microarchitectural work for us to account for stronger memory order on the x86 side, but of course the software has to account for the weaker memory ordering on the ARM side. So there are tradeoffs.
I don't think this makes sense either since software has to have synchronisation anyway. I don't think much software relies on x86 TSO (intentionally anyway; I'm sure many bugs are covered up by it).
Anyway fantastic interview! Very refreshing when they're actually technical with interesting questions and answers.
mbitsnbites · 2024-01-23
> The average A64 instruction does slightly less work than the average AMD64 instruction so the net result is that it makes sense to have slightly wider decoders
I'm not sure that the difference is that big. A64 actually has quite powerful instructions, and some of them do more work than similar x86 instructions (madd and ubfx come to mind). In my testing A64 code often has fewer instructions than x86: https://www.bitsnbites.eu/cisc-vs-risc-code-density/
> X86 CPUs don't quite use a "RISC-like encoding". The µops support RMW for memory, for example.
I would love to learn more about that. Do you have any references? I was under the impression that internal instructions followed the load/store principle since I assume that the internal pipeline is a load/store pipeline?
> The Power CPUs call it "cracking" when complicated instructions are split into simpler µops.
Yes, it's the IBM term AFAIK. They call it cracking in zArch too. I also suapect that at least some ARMv8/9 implementations do cracking too (many AArch64 instructions have multiple results, which might be better handled as multiple internal instructions - I think it's partly a code density thing).
phire · 2023-10-24
It doesn't matter how optimised the length decoding is. Not doing it is still faster.
For an 8-wide or 10-wide design, the propagation delays are getting too long to do it in all in single cycle. So you need the extra pipeline stage. The longer pipeline translates to more cycles wasted on branch mispredits.
RISC-V code is only about 6-14% denser than Aarch64 [1], I'm really not sure the extra complexity is worth it. Especially since Aarch64 still ends up with a lower instruction count, so it will be faster whenever you are decode limited instead of icache limited.
> Adding complexity to the I$ hasn't even made sense for x86 in two decades
Hang on. Limiting the Icache to only 32bit aligned access actually simplifies it.
And since the NUVIA core was originally an aarch64 core, why wouldn't they optimise for hardcoded 32bit alignment and get a slightly smaller Icache?
[1] https://www.bitsnbites.eu/cisc-vs-risc-code-density/
0xf00ff00f · 2024-01-17
Wow, how crazy is this? This guy:
* Designed a 32-bit ISA with vector instructions [0]
* Implemented it on an FPGA
* Wrote a gcc backend for his ISA [1]
* Ported Quake, and it seems to run pretty well (Quake required a high-end Pentium back in the day)
Now this is a full-stack developer.
[0] https://www.bitsnbites.eu/the-mrisc32-a-vector-first-cpu-design/
[1] https://gitlab.com/mrisc32/mrisc32-gnu-toolchain
hgsgm · 2023-06-04
Daniel_sk · 2019-03-27
I have a Dell XPS (2018?), 16GB RAM, 512GB SSD, i7 and 3 year on-site warranty. I am running Linux Mint on it for Android development (Windows is much slower for building Android apps, because NTFS is slow at handling lots of small files - http://www.bitsnbites.eu/benchmarking-os-primitives/). I am really satisfied with the notebook and I had a Macbook for about a year before buying the XPS. There basically maybe 2 things I don't like - the camera position is weird, it's in the lower left corner so you get recorded from a weird angle, I think they moved the camera in the latest model? And, typically Linux, sometimes I have echo and mic problems but Zoom seems to be reliable. No issues other than that.
iaml · 2018-04-03
>Stuff is just [...] faster on windows
Windows is the slowest of OSes, see http://www.bitsnbites.eu/benchmarking-os-primitives/
throwawaylinux · 2022-12-11
Fork is actually very fast. Too funny a paper coming from Microsoft about fork/exec speed -
https://www.bitsnbites.eu/benchmarking-os-primitives/
Linux absolutely destroys the "proper" API. Nearly 40x faster at launching a program with fork+exec than Windows' CreateProcess. Not to mention the fact that vfork has always been available which is even faster.
Fork is also pretty scalable, it requires no global locks. It is thread-safe, it has defined semantics in threaded programs and can be used to exec a process. And it isn't insecure, it does what is advertised, as securely as advertised.
And close on exec is hardly a huge complication, it's actually a detail of exec(), not fork. It applies independently of exec, and you could make an exec that closes fds by default unless they're marked with a persist-on-exec flag. Library or runtime code can do this anyway really without any "huge complication". I don't know what you mean about SCM_RIGHTS interfering with fork, do you have something in mind? The problem would really be at the exec boundary, fork does not purport to alter any security attributes of the child or parent, so it really doesn't make sense to call it insecure. It doesn't suddenly get new rights, or have any limits enforced.
I mean it is complicated stuff, but so is any process runtime environment that provides async notifications, threads, spawning, etc. Anybody who tells you they can make this simple and broadly usable is selling you snakeoil or a toy API.…
yebyen · 2017-06-30
It's really important in TDD to know that your test fails when the code you write for that feature it is missing. If it doesn't fail, that's a false positive. The prescribed pattern is, you write your test (it should be red), you write your code (it should turn green), you commit, push to CI, look at the rest of the tests, make sure none of them turned red... take another look at the code, refactor, commit, push to CI, look at tests again, and then start over on the next feature.
(Edit: OK so reordering the commit is not actually the most important part, it's checking out that commit you reordered: with the code for the test, without the matching code for the implementation; and running the test to make sure that it fails until the feature is implemented.)
I don't really care if you think it's cheating to reorder the commits, if it gets the job done faster / better in some way. I'm not writing code for a grade, I'm writing an application that I'll need to maintain later. If that feature breaks and that test doesn't turn red, it's been a complete waste of time writing it (and actually has provided negative value, because I will now be less inclined to test that behavior manually, knowing that there is a test and it passes.)
That's a false positive that you can easily guard against by reordering the commits before squashing/merging everything back and confirming you see some red where it's expected. (You don't need to reorder if you did actually write the test before…
git-pull · 2017-08-09
No one's perfect with this stuff.
If you don't believe me, clone git itself ($ git clone https://github.com/git/git) and open up the repo in tig(1)
https://github.com/jonas/tig
To be honest, I only in the past 2 years even bothered to view ($ git log --graph). Regardless of --graph getting wide now and then, I always visualize my git history as a straight line.
Also, sometimes having a non-linear history is inevitable. Especially in large open source projects where you're pulling in patches to a branch, and patches on top of that. You're not always going to be merging a branch with a single author straight onto master.
Despite posts like this (http://www.bitsnbites.eu/a-tidy-linear-git-history/) encouraging good git hygiene, I've had multiple open source projects merge in code via GitHub and never had negative consequence for it :P
Maybe there are corner cases where git bisect wouldn't work? Though I never used git bisect even once. Most I do is scroll through tig and view diffs. Also used to play with a cool git plugin in vim (https://github.com/tpope/vim-fugitive).
Also, GitHub has (since that linear git history post) introduced Rebase + Merge https://github.com/blog/2243-rebase-and-merge-pull-requests. I think that'll get you what you want.
I do keep branches ("pull requests" if you're using GH lingo) up to date with ($ git pull --rebase). That does mean a force push ($ git push --force), but it's ok if it's your personal branch. I also use interactive mode ($…