Joseph Garvin Profile
Joseph Garvin

@joseph_h_garvin

Followers
1K
Following
31K
Media
790
Statuses
14K

voicecoding latency and throughput hacker. How did I get here and what am I doing in this hand basket? @[email protected] @josephhgarvin.bsky.social

Joined July 2009
Don't wanna be here? Send us removal request.
@joseph_h_garvin
Joseph Garvin
10 months
Hello Twitter. I post mostly about: - Low latency programming - Programming Language design - Metaprogramming - Rants
3
0
43
@joseph_h_garvin
Joseph Garvin
3 hours
As always I have no idea without further digging if the plot is actually correct. But I'm amazed it could even do the legwork to make a good superimposed line with correct clipping!
0
0
0
@joseph_h_garvin
Joseph Garvin
3 hours
Looking through the traces it used OpenCV to find the pixel coordinates for the gray horizontal lines. It had a first attempt where the Facebook line blew through ymax, recognized the issue and added the clipping code.
1
0
0
@joseph_h_garvin
Joseph Garvin
3 hours
Lay people won't appreciate why this is impressive but this is one of the craziest things I've seen GPT5 do. I gave it this graph from FT and asked it to add Facebook adoption for comparison, and rather than generate a new graph it seemingly correctly superimposed a new line!
1
1
1
@joseph_h_garvin
Joseph Garvin
1 day
One nit is that iter vs ptr safety are separate. If you do the brute force way, when the Vec resizes ptrs will invalidate even if your iters don't (because underneath they are just indexes). But you can write a Vec with lg(n) lookup that has pointer stability.
0
0
0
@joseph_h_garvin
Joseph Garvin
1 day
You can even get other nice properties out of it. A hash table that keeps its items in a doubly linked list also remembers insertion order even across resizes. As long as the focus is on having the go-to stdlib containers be safe general choices, surely this is more general?
1
0
1
@joseph_h_garvin
Joseph Garvin
1 day
Wondering why more systems/value-types languages don't default to using containers that prevent iterator/pointer invalidation. Even if you do it the brute force way (keep separate vec of items, make the container be indexes into the vec) it's a relatively cheap way to add safety.
3
0
6
@joseph_h_garvin
Joseph Garvin
1 day
Have not compared, but suspect codegen for the callback approach averages better (when monomorphizing on the callback, i.e. when templating on F) than the iterator approach, because things stay in regs instead of needing to be reloaded again based on what's kept in the iterator.
1
0
1
@joseph_h_garvin
Joseph Garvin
1 day
But paying for the moving out cost of take when you don't need to do any more work on the value is annoying (move is still a shallow memcpy). So callback it is I guess? Or you cross your fingers and hope the inliner nukes the redundant instructions.
1
0
1
@joseph_h_garvin
Joseph Garvin
1 day
In hash table APIs where lookups return pointers rather than iterators, you face the issue that a lookup followed by an erase (b/c you need to do some work on the item before erasing) is 2x lookup work. So then erase needs an on_found callback, or instead of erase you need take.
5
0
7
@joseph_h_garvin
Joseph Garvin
2 days
So is it just the same old farts talking to each other now?
0
0
2
@joseph_h_garvin
Joseph Garvin
2 days
Rust doesn't have increment or decrement operators, so there was no natural operator to overload. It does have AddAssign and SubAssign, but they allow stepping by more than 1 at a time, which many iterators don't support.
0
0
2
@joseph_h_garvin
Joseph Garvin
2 days
People diss the C++ STL because of perf but there are interesting ideas in it. Making the leap from using pointers to crawl structures to using iterator objects with pointer syntax to being generic over both was an interesting trick that Rust chose not to copy.
4
0
13
@joseph_h_garvin
Joseph Garvin
3 days
Every behavior my software relies on in yours is sacred, every behavior your software relies on in mine is technical debt.
0
0
8
@joseph_h_garvin
Joseph Garvin
5 days
Saw someone mention doing a block jubilee (minus obvious bots) which I don't think is a terrible idea. Curious to see how long it takes the list to go back.
0
0
1
@joseph_h_garvin
Joseph Garvin
6 days
Working in C++ one of the few big things I miss for metaprogramming compared to Rust is rustdoc. Headers don't work well as your lib docs when your interfaces are generated by a ton of magic, but big interfaces generated by Rust macros can still result in readable docs.
2
0
8
@joseph_h_garvin
Joseph Garvin
9 days
HashTable needs try_insert, replace, upsert. And lazy versions that take a closure and construct if no existing key. And you want to be able to pass through a ctx param if your extract_key(Ctx,V)->K function needs it b/c V is an index into another container. So 12 overloads? 💀
0
0
1
@Leik0w0
Léo
10 days
@joseph_h_garvin I like the idea that if you drop the box, whatever was in it isn’t working anymore lmao
0
1
2
@joseph_h_garvin
Joseph Garvin
10 days
No but really, compilers are not that smart (at least GCC isn't, Clang gets it).
7
0
13
@joseph_h_garvin
Joseph Garvin
11 days
"Box" seems like bad terminology when the whole point of using Vec<Box<T>> instead of Vec<T> is that moving the box does not move what is inside of it. I don't know of any real life box that works that way! If anything I'd naively expect Box to mean T is stored directly.
23
2
127