1.98K subscribers
3.96K photos
157 videos
15 files
4.11K links
Блог со звёздочкой.

Много репостов, немножко программирования.

Небольшое прикольное комьюнити: @decltype_chat_ptr_t
Автор: @insert_reference_here
Download Telegram
#prog #rust #article

Query cycles: A compiler murder mystery

Или как сделать баг настолько мощный, что отваливаются отладочные инструменты.
🤔4❤‍🔥3
Блог*
Polished technical products no longer indicate effort and understanding.
#prog #zig #ml #article

Собственно, именно по этой причине в Zig запретили использование LLM вообще.

Contributor Poker and Zig's AI Ban

TL;DR: Zig foundation заинтересованы в том, чтобы контрибуторы вовлекались в сообщество и набирались экспертизы, а использование LLM очень часто на практике означает отсутствие желания разбираться и оставаться с сообществом.
👍191🖕1
#article

Some thoughts on writing (от Dan Luu)

I see a lot of essays framed as writing advice which are actually thinly veiled descriptions of how someone writes that basically say "you should write how I write" <...>

<...> if you're trying to figure out what stylistic choices are right for you, you should start from your goals and what you're good at and go from there, not listen to somebody who's going to tell you to write like them. Besides being unlikely to work for you even if someone is able to describe what makes their writing tick, most advice is written by people who don't understand how their writing works.

Как это часто у Dan Luu бывает, у эссе несколько дополнений, некоторые из которых с основной темой связаны несколько косвенно.
8
Блог*
#prog #rust #article Rust threads on the GPU
#prog #rust #article

Rust SIMD on the GPU

Код на Rust, использующий core::simd, может быть использован на GPU без изменений на уровне исходников!

К сожалению, на текущий момент применимость этого подхода несколько ограничена, поскольку core::simd всё ещё закрыта за фичей portable_simd, и авторам пришлось внести изменения в компилятор для устранения оверхеда.
🔥5👍32
#prog #rust #article

Downcasting Arcs in Rust

...И о том, как можно (небезопасно) сделать это настолько дешёвым, насколько возможно
👍1🤔1
#prog #rust #article

Protecting the Rust standard library from accidental breakage

Accidental breakage can happen in any codebase. The Rust standard library isn't magically exempt from this — so it too now uses cargo-semver-checks to prevent accidental breakage. Here's why this took months of work by multiple Rustaceans, dozens of pull requests, and 15,000+ lines of code across the Rust repo, cargo-semver-checks, and its component libraries.
😁5🤔2👍1
#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 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

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

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.
👍71
#prog #js #abnormalprogramming #article

The Depths of JavaScript: Minesweeper in 247 Bytes

b=e=>document.body.innerHTML=m(73,e||[~9,..."1172711",~9].map(j=>m[i-=j]?++e:i).map(j=>b(b[i=j]^1|e),b[i]=!m[O--,i]*~e));b(m=t=>t--?`<a onmouseup=b(b[i=${t}]^=event.which)>${t%9?"*#F"[x=b[t]??=(O-=m[t]=Math.random()<.1,1)]??~x:"<p>"}`+m(t):O,O=64)
🔥13😱1
#prog #rust #article

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 #article

Implementing FMA and finding bugs in C and Rust standard libraries

This is a story of how I tried to compute a * b + c, and found that Rust and musl libc get it subtly wrong.
🤯8👍1
Блог*
#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

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.
🤔7👍1🔥1
#prog #rust #article

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

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
🤔2
#prog #article

Bespoke: A Programming Language for People Who Say Please

I therefore propose Bespoke, a statically typed and uncompromisingly civilised programming language for developers who believe that machine execution should never come at the expense of good manners. Informally it is known as The Queen’s Code: Victoria’s, naturally; the etiquette committee has yet to approve the twentieth century. Source files use the .charming extension, and the compiler reserves the right to be disappointed in you.
9😁2
#prog #rust #article

Rust: When Empty Isn't Bottom

Или почему ! в Rust не является bottom типом. TL;DR: в Rust нет отношения подтипизации для типов, не включающих лайфтаймы.
4🤔2
#prog #java #article

JVM Anatomy Quark #23: Compressed References

Спека Java ничего не говорит о том, как представляются ссылки. Как следствие, реализации могут использовать представление ссылок, которые меньше указателя на машине. Статья описывает эти трюки.

Несколько неожиданное следствие: эти трюки работают только на достаточно маленьких кучах, поэтому выделение JVM большего количества памяти может привести к тому, что куча выйдет за этот предел, ссылки перестанут использовать компактное представление и потребление памяти многократно вырастет.
🥴4🤔3
#prog #haskell #article

Type-level programming is still programming

TL;DR: вычисление типов, в отличие от вычисления термов, не является ленивым, и изменения в логике вычисления типов, не меняющее поведение, могут поменять асимптотику времени компиляции с экспоненциальной на линейную.
7👍2🔥1💩1