2025-10-21 13:13:43
"How to Optimize Rust for Slowness" – Carl Kadie
#rustlang
"How to Optimize Rust for Slowness" – Carl Kadie
#rustlang
#RustLang is great and rock solid. That's why when you build the Rust compiler against LLVM with assertions enabled, it crashes on unmet assertions.
#RustLang jest wspaniały i stabilny. Dlatego jak się zbuduje kompilator na LLVM, które ma załączone asercje, to się wykrzacza na niespełnionych.
Sequoia PGP exemplifies everything that's wrong about #RustLang (don't mean this against Sequoia). It features a bunch of different CLIs, which is a reasonable design.
If Sequoia were written in C, these CLIs would probably be using some shared library. If Sequoia were written in Python, they would probably use a shared Python package. However, it's written in Rust, so every CLI is a huge binary with its own copy of subset of shared Sequoia code, built separately:
-rwxr-xr-x 1 root root 12M 10-08 06:36 /usr/bin/gpg-sq
-rwxr-xr-x 1 root root 4,7M 10-08 06:36 /usr/bin/gpgv-sq
-rwxr-xr-x 1 root root 21M 10-08 08:38 /usr/bin/sq
-rwxr-xr-x 1 root root 6,9M 10-08 08:38 /usr/bin/sqop
-rwxr-xr-x 1 root root 3,1M 10-08 08:32 /usr/bin/sqv
Sequoia PGP ukazuje wszystko to, co jest nie tak z #RustLang (nie czepiam się tu projektu Sequoia). Mamy kilka różnych binarek CLI, co ma sens.
Gdyby Sequoia była napisana w C, to najpewnie używałyby jakiejś biblioteki współdzielonej. Gdyby napisała była w Pythonie, to najpewniej mielibyśmy wspólną paczkę Pythona. Ale napisano ją w Ruście, więc każdy interfejs to odrębna, wielka binarka z włas…
New article on the blog!
This time, it's about how I optimized an algorithm which turns byte offsets into line/column numbers and UTF-16 offsets.
Most of the performance improvement came from the use of SIMD to efficiently count ASCII characters.
#rust #RustLang #SIMD #optimization #blog