Блог*
#prog #rust #rustreleasenotes Вышел Rust 1.98.0! Как всегда, кусочки — тут, мясо — там. ▪️Обычно я пишу про новые вещи в порядке: фичи языка, добавления в std, изменения в cargo. В этот раз я напишу сначала про фичу, которая номинально является новым API…
#prog #rust
Ииииии на этой версии обнаружили P-Critical баг: компилятор может генерировать vtable с null. К счастью, должны пофиксить быстро, потому что на бете уже не воспроизводится.
Ииииии на этой версии обнаружили P-Critical баг: компилятор может генерировать vtable с null. К счастью, должны пофиксить быстро, потому что на бете уже не воспроизводится.
😁12🫡5👍1
#prog #rust
В Rust стабилизировали тип never. Да, опять. Но на этот раз вроде окончательно, все крейты, сломанные из-за смены фоллбека или получили апдейты, или дико старые. Если всё пройдёт гладко, дойдёт до stable в красивой версии 1.100.
В Rust стабилизировали тип never. Да, опять. Но на этот раз вроде окончательно, все крейты, сломанные из-за смены фоллбека или получили апдейты, или дико старые. Если всё пройдёт гладко, дойдёт до stable в красивой версии 1.100.
🔥19❤2
#prog #rust #article
Replacing a Rust Enum with a 64-bit Word Made My Interpreter 17% Faster
Replacing a Rust Enum with a 64-bit Word Made My Interpreter 17% Faster
<...> That being said, sha256_unfixed is still running 12% faster with the new value representation than with the old version, even though it's allocating a total of 3,149,052 boxed integer values in a span of about 490 ms. That seemed a bit crazy to me, but having a copying GC with a bump allocator means that we can allocate objects really fast.
👍5🫡2
#prog #rust #article
How we saved 100 terabytes of memory by optimizing 1.1.1.1’s DNS cache
Большая часть изменений довольно простая.
How we saved 100 terabytes of memory by optimizing 1.1.1.1’s DNS cache
Big Pineapple, the platform behind 1.1.1.1, Gateway DNS, DNS Firewall, AS112, and several other Cloudflare DNS services, stores over 250 billion DNS cache entries at any given time. At that scale, wasting a single byte per entry costs more than 250 gigabytes of memory across our fleet.
Five successive changes to how cache entries are stored in memory cut the per-entry footprint by over 50%. Across our fleet, these changes freed up roughly 100 terabytes of memory, equivalent to the amount of RAM in 130 of our Gen 13 servers. The cache also got faster. Insert throughput rose 43% and lookup latency dropped 19%, as fewer allocations and better memory locality meant we did not trade speed for space.
Большая часть изменений довольно простая.
🎉7🔥2🤔2
#prog #rust #article
How I made Rustdoc 33% faster in one week
How I made Rustdoc 33% faster in one week
More than any technical detail, the learnings I most want you to take away are to trust your instincts and to question assumptions. Just because a piece of code (or anything, not just code!) has been a certain way for a long time doesn’t mean that it’s optimal or even correct.
👍7❤1
#prog #rust #article
iddqd, or the hardest kind of unsafe Rust
iddqd, or the hardest kind of unsafe Rust
I’m the main author of iddqd, a Rust library for maps (named after the Doom cheat code) where keys are borrowed from values. <...>
iddqd consists of a fair amount of unsafe code underneath. There’s been some recent concern over the amount of unsafe code in Rust rewrites, so I thought I’d write about some of the unsafe code in iddqd and how we try to tame it.
🤔3
Блог*
#prog #rust #article Replacing a Rust Enum with a 64-bit Word Made My Interpreter 17% Faster <...> That being said, sha256_unfixed is still running 12% faster with the new value representation than with the old version, even though it's allocating a total…
#prog #rust #article
Plush's New Register-Based Interpreter Is Insanely Fast
Plush's New Register-Based Interpreter Is Insanely Fast
I'll go into some detail on how the interpreter was rewritten to switch from a stack-based design like CPython, to a register-based design like Lua, and optimized to deliver some surprising, and I think pretty impressive results. One thing I'll say right away is that if you care about interpreter performance, you probably should not be writing stack-based bytecode interpreters in 2026.
🤔6👍1🔥1
#prog #rust #article
Could Cargo's scheduler be better?
Автор поста собрала записи того, сколько времени уходит на компиляцию каждого крейта во время сборки разных проектов, и решила проверить, можно ли было ускорить сборку за счёт использования порядка сборки, отличного от того, что используется в cargo. В качестве приоритета она использовала т. н. b-level — фактически критический путь в графе зависимостей в терминах длительности компиляции.
TL;DR: этот гипотетический вариант эффективнее cargo и переживает добавление нормально распределённого шума (с разбросом ±60%) и схлопывание информации о длительности до одного бита (долго/недолго).
Could Cargo's scheduler be better?
Автор поста собрала записи того, сколько времени уходит на компиляцию каждого крейта во время сборки разных проектов, и решила проверить, можно ли было ускорить сборку за счёт использования порядка сборки, отличного от того, что используется в cargo. В качестве приоритета она использовала т. н. b-level — фактически критический путь в графе зависимостей в терминах длительности компиляции.
TL;DR: этот гипотетический вариант эффективнее cargo и переживает добавление нормально распределённого шума (с разбросом ±60%) и схлопывание информации о длительности до одного бита (долго/недолго).
❤5👍1
#prog #rust #rustlib #article
The Design Behind wincode, a Faster Rust Serializer
TL;DR: запись в предоставленный MaybeUninit буфер, батчинг валидаций для последовательностей "простых" значений, специализация по типам, использующая сгенерированную derive-макросами метаинформацию (facet на минималках)
The Design Behind wincode, a Faster Rust Serializer
wincode is a fast, bincode-wire-compatible serializer and deserializer for Rust, built by Anza originally for the Agave validator. It is not a fork of bincode. It is a new implementation with its own traits and derive macros that produces the same bytes as bincode's default configuration
TL;DR: запись в предоставленный MaybeUninit буфер, батчинг валидаций для последовательностей "простых" значений, специализация по типам, использующая сгенерированную derive-макросами метаинформацию (facet на минималках)
🔥3🤔1
#prog #rust #article
Proving my Rust NVR doesn't leak memory (it did)
К сожалению, описанные методы диагностирования специфичны для MacOS
Proving my Rust NVR doesn't leak memory (it did)
К сожалению, описанные методы диагностирования специфичны для MacOS
🤔2
#prog #rust #article
Rust: When Empty Isn't Bottom
Или почему
Rust: When Empty Isn't Bottom
Или почему
! в Rust не является bottom типом. TL;DR: в Rust нет отношения подтипизации для типов, не включающих лайфтаймы.❤3🤔2