Profile avatar
josephhgarvin.bsky.social
voicecoding latency and throughput hacker. How did I get here and what am I doing in this hand basket? he/him
621 posts 384 followers 1,563 following
Prolific Poster
Active Commenter

All I wanted is a C++ CLI parser that types the CLI args, doesn't allocate and doesn't use iostreams. I won't write it myself, I won't write it myself, I won't write it myself...

To anyone paying attention to today's news it's looking more and more like the push to normalize people using their real names online was extremely misguided.

Are the xoroshiro people right or are the PCG people right? Somebody get me up to speed without me writing my own test suites.

I need a type system that will enforce I don't store this array at the end of a page so I can do loads that leak over and mask out the extra bytes.

As slick as it is to have a Qt visualization when debugging a data structure I'm not noticing a huge value add over dumping graphviz dot files into a folder, then running a script that converts to png and opens them in an image viewer where I can press arrows to go forward/back.

What would the language extension look like that would allow SIMD for Rust/C++ clone-impls/copy-constructors? Meaning you want the SIMD operations to allow you to copy construct multiple objects simultaneously, not use SIMD to make one copy faster.

Unbelievable fail for @bsky.app to not implement group DMs before Twitter removed them. Could have been a flood of users.

What is the type system answer to accidental sign flips? Many quantities can legitimately be both positive and negative.

Say you have a value in a 4 byte register, and you want to write 3 bytes out of it into the low 3 bytes of an aligned 4 byte word in memory, without changing the most significant byte. Which is faster? (Assume modern x86-64) Why? A) Load4, bitwise Or, store4 B) Store1, store1, store1

C++ is a lot nicer with variable interpolating fstrings and the ability to concisely test cross products of flow control.

Unexpected result I should have expected: asking Claude to write C++ parsing and string manipulation code with std::string works much better than asking it to write the equivalent C code. I can think of a few possible explanations...

Another day, another learning something C++ screwed up

Ironic glitch when asking Claude about code not counting string length correctly due to escape sequences...

Realized there is a trap for other langs trying to adopt Python style f-string interpolation. In Python you can write `f"{'hello':>15} world"` to write out hello with 15 padding. But how would that work in C++ or Rust? They only have one syntax for string literals! Escaping.. 1/2

Exceptions should have a method to write their message out to a stream rather than returning a string. Avoids allocations.

New discovery: running gnu parallel with `--noswap` is 5x slower. Fun fact: I don't even have a swap partitition 🤷‍♂️

Still surprised nobody has risen to dethrone Python for general scripting/glue just based on this

"Why is this script slow? Lets trace the processes." "Wait wtf is this, why are there a ton of sleeps? I never call sleep?" "Wait why is gnu parallel shelling out to sleep?!"

Faster Python forks are the invading-Russia-in-winter of software optimization Build systems are the invading-Russia-in-winter of software design

You want man pages? configuration.nix: documentation.man.enable = true; dev shell for a specific project: this?!

Spent a couple days setting up new laptop with nix + home manager (first time), came back to my real work and immediately stomped the bug that I'd wasted hours on before. Pretty sure the lesson here is to go down all rabbit holes.

The best argument against a language that exclusively supports structured concurrency is you can't implement a good runtime for structured concurrency with structured concurrency.

Did you know that bash comes with a profiler, but only if you're sick enough?

uh, ok

Not enough people appreciate that byte buffers are a powerful (and the cheapest form) of polymorphism. Doesn't matter what container type you're using if you can pass me contiguous slices.

AFAICT there is no way in C++ to express a concept that requires a container implement emplace_back. You can't require the existence of template method, only test that specific instantiations work. The irony of the feature that only exists for templates to not support templates..

Say you have a buffer where bytes [0,N) are no longer needed, and [N,M) are. You get a request to put more than M bytes into the buffer (so you must resize). Ideally you would not copy the first N bytes into the new allocation, but that's not supported any typical 'resize' op.

It's lame that neither C++ nor Rust provide the ability to change the type of a variable in place. In C++ `reinterpret_cast` is almost always undefined behavior (and won't prevent the local with the old type from destructing), `bit_cast` copies, and in Rust `transmute` copies.

Which is better for preventing pointer invalidation when a buffer resize occurs, handles that use double indirection or handles that use single indirection but form a (known small) intrusive linked list that we iterate and patch on resize? o3-mini-high disagrees with the others.

What is the maximum number of destructors generated for a single C++ class inside a binary compiled for Linux x86-64? Not counting duplicates due to inlining/optimizations, and considering every instantiation of a class template to be a different class.