What is Nostr?
Hector Martin /
npub1qk9…azpx
2024-05-28 17:01:56
in reply to nevent1q…zts4

Hector Martin on Nostr: Heavy inlining plus Rust generally putting everything on the stack unless you specify ...

Heavy inlining plus Rust generally putting everything on the stack unless you specify otherwise. We *already* have fairly deep voodoo magic because some GPU firmware data structures are 32K+ and they literally could not be constructed in Rust the normal way without overflowing the stack immediately.

Visibility into stack frame bloat is limited, so it's hard to figure out where most of it comes from. It could be something as simple as an object with a fixed-size 32-array of nontrivial objects getting copied around instead of heap-allocated, or just too much inlining with LLVM being too dumb to reuse stack frame space across inlined functions. It would be nice to have better tools to understand this.

But really, in any language, it's not terribly hard to come up with an object that is a kb or two if you nest enough complex structures. Even in C you can accidentally end up doing that.

It's not dumb buffers, we know not to put those on the stack :P
Author Public Key
npub1qk9x6yrvten3jqyvundn7exggm90fxf9yfarj5eaz25yd7aty8hqe9azpx