Unofficial Hacker News client - receive Push Notifications on replies.

The state of Rust allocators in 2026: stabilised (opens external site)

200 points by fanf2 2 days ago | cetra3.github.io | 82 comments on HN | Vote on HN (opens Hacker News)

View full thread · View on Hacker News

Comment thread (6)

  1. It already is bloated.

    I'm not saying it is a bad language as I use it since 9 years and still write new code in it.

    But if you compare writing an bump allocator in c or zig vs rust, it is comically bloated. Same applies to anything like a vector or a hashmap or anything else low level.

    You get a binary that is multiple megabytes if you just write a webserver on the path of least resistence.

    Replies (2)
    1. the Rust version of bcachefs has an object size 50% bigger than the C version, without trying to optimize for object size and with a whole bunch of new code to replace things that we used to get from the kernel but weren't Rust.

      Even if that doesn't shrink I consider that a very good tradeoff for what we're getting.

    2. May I ask if you're comparing apples to apples (statically linked everything) in the last case? I'm not very well versed in C or C++, but I do know that a common practice there is dynamically linking the world, so I'm curious if the size difference stays if you link statically in both cases?
      Replies (2)
      1. I write zig like C++ code where there is no headers (I use modules only) and I don't depend on libc or use any standard headers. The output binaries are extremely small if you also enable the linker garbage collection.

        So everything is statically linked and only depends on linux syscall API. It is not apples to apples compared to rust but you can't practically do that in rust anyway.

        Replies (1)
        1. What's stopping you? I do that on Windows; the trivial example of "add two numbers" is a 4kb DLL.

          You don't use the standard library, the equivalent of the kernel syscall API is there (the win32 API), and you have the ecosystem of no_std libraries available.

      2. Statically linking C code with glibc is more bloated than rust in my experience. However, using musl instead gives you binaries that easily fit in 10s of KB (compared to rust which I got to 300KB on stable without sacrificing the standard library)