Speed of Rust vs. C

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • llvm-propeller

    PROPELLER: Profile Guided Optimizing Large Scale LLVM-based Relinker

  • > In theory, Rust allows even better optimizations than C thanks to stricter immutability and aliasing rules, but in practice this doesn't happen yet. Optimizations beyond what C does are a work-in-progress in LLVM, so Rust still hasn't reached its full potential.

    Really glad to see this mentioned, I search for it in every post like this.

    LLVM should follow now that the mutable noalias bugs appear to be fixed. Remember when it was a meme that every time it gets enabled in rustc, it has to be disabled again in the next .1 release? It's been left enabled for years.

    The biggest challenge here is that most people aren't looking for optimizations beyond what they were already getting with C. Like when Google was switching from GCC to Clang, they'd pick apart the asm and report bugs for Clang and LLVM to converge on GCC. That was a big part of why the performance gap closed over the years. But that was closing a gap, not speculatively overtaking them.

    Then there's a whole other angle; we now know just how much machine code layout can affect real-world performance, in most cases much more than aliasing rules, but we still haven't made it a seamless part of our build tooling. PGO is now fairly easy, but BOLT is still a pain to integrate for no clear reason, and PROPELLER has been left in an embarrassing state where even its own PDF link is broken [1]. (To be fair, it may not be Google's highest priority at this time.)

    [1] https://github.com/google/llvm-propeller

  • jemalloc

  • The worst memory performance bug I ever saw turned out to be heap fragmentation in a non-GC system. There are memory allocators that solve this like https://github.com/jemalloc/jemalloc/tree/dev but ... they do it by effectively running a GC at the block level

    As soon as you use atomic counters in a multi-threaded system you can wave goodbye to your scalability too!

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts