HNHacker News
TopNewBestAskShowJobs

mtklein

659 karma · joined August 27, 2010

submissionscomments
mtklein··on Kevin Bacon's missing clothes finally delivered in Ireland
My first skim had me thinking he sent the package in the 90s; sadly it was just three weeks ago.
mtklein··on More floating point alternatives
That's kind of exactly what floats are. You store the log2 of the number, a bit for its sign, and in what remaining bits you have left some fixed-point scaling between adjacent powers.
mtklein··on Compiler-style optimization for drawing via Skia
That's how we felt answering performance questions of our own... we needed to know if our work was important, and the tools help keep that focus locked in. I'm no longer on the Skia team, but like, welcome to the Skia team; if you use nanobench, you're legit. :)

I'm the same user name @gmail.com if you ever have any questions. It's been a while but I'd be happy to try to page things back in for a good cause.

mtklein··on Compiler-style optimization for drawing via Skia
As a former Skia contrib, this is cool as heck to read. It's exactly the sort of optimization work we had in mind when we wrote that SkRecord system, and I'm pleased that you were able to make use of nanobench. Back in those days we had just a few small optimizations that we could apply, mostly trying to eliminate unnecessary saveLayer() calls. Very cool to see it done in a modern way with Lean.
mtklein··on Just Bury Your Trash
Decades ago they used to pull completely off the can (think Jimmy Buffet "stepped on a pop-top").
mtklein··on I am no longer letting Claude Code add itself as Co-author in my commits
I should barely be listed as a co-author on what Claude does for me. Hiding Claude's contribution feels about as true as a combover to me.
mtklein··on Does the Sumerian King List Align with Paleoclimate Events?
That's kind of what reddit used to feel like when it was brand new. Can you believe it?
mtklein··on If this is true, the hyperscalers are toast
I have found qwen 3.8's coding quality using opencode to be similar to claude or gpt from 6-9 months ago, except much slower.
mtklein··on Moving integer division to floating-point is trivial
My rule of thumb is that integer ops cost 1 cycle except divides, floats 3 but maybe divide is a bit more, then integer divides are like infinity at 20+ cycles that cannot be amortized by vectorization.

When you code simd it's best to assume the integer divide instruction does not exist. Just an impossibility, if you need to divide ints, rethink your whole program.

mtklein··on Moving integer division to floating-point is trivial
They're typically like a 3-cycle op, right? Obviously that's not zero, but as far as floating point ops get it's a cheap as it gets, like an add, mul, fma, that sorta thing.
mtklein··on Delta
Don't forget SubEthaEdit! That was the first multiplayer editor I recall.

Never found a use for this sort of thing once novelty wore off. :/

mtklein··on The LLM Critics Are Right. I Use LLMs Anyway
I don't think there is necessarily one ideal middle ground here. It still feels to me like what's best is a function that depends on who and when.

I see it as something like a personal gradient descent. You're working on a problem, there are solutions down there somewhere, and you can kind of feel the gradient of the tools-and-techniques ground around you. Any way you walk means you're investing time improving some skill or another. So you should go the way that personally feels to you will best get you moving in the direction that you want to go.

For some people it's obvious LLMs are competent coders, getting better, sticking around... and those people should lean into that gradient. For some people what's obvious is nearly the exact opposites of all that, and I'd encourage those people to also follow their gradient/heart/nose down the path of sharpening their personal traditional coding skills. Some people are in a relatively flat area where nothing is obvious, and need to explore and maybe just keep doing their best to hedge with a bit of both.

mtklein··on Ask HN: How do you use Vim in the era of AI?
Yeah it makes me sad too. It's a one-way veil, no going back once I experienced the new magic.

Sometimes I pop back into a terminal, mkdir, git init, crack my knuckles to do some all-natural hacking and the sadness sets in before the hour is up... "why am I insisting on doing this the long way? I know this project would be better with me in a different role now."

Coding for me has always been a balance of process and ends. Getting done what I wanted done mattered most, but I can't pretend that I didn't also enjoy being the moving parts of that process. And I am most grateful for what I learned by throwing myself over and over against problems I didn't quite know how to solve. There's a satisfaction to doing a thing well that I always love being a part of, still do, anything, even doing the dishes or laundry.

And just recently with Opus I found myself having some really joyously manic days and weeks, making calls, picking tech, designing APIs, insisting on quality, keeping agents spinning. But Fable just kind of came in with "oh, I can do that all for you too. You can relax," and that was both exactly what I wanted and what started making me realize this had all finally caught up to me.

I never wanted to be management, but I can't unsee that I am more effective now playing Fable's boss than I was the last few months as TLM of a squad of Opuses, and that was more effective than just coding myself the way I love.

mtklein··on How do you use Vim in the era of AI?
On about day 2 of using Fable I realized that the .vimrc I'd been maintaining for 15-20 years would probably never change again.

With Opus I still feel like I'm pair coding and want to get in there and make some changes myself, but working with Fable (even Fable managing Opus agents) had me in a completely different mindset, one where I realized I would just be getting in the way.

mtklein··on The Garbage Collection Handbook: The Art of Automatic Memory Management (2nd Ed) (2023)
I have never seen Codex or Claude get manual memory management wrong. I used to be pretty fastidious about using leak sanitizer or other such tools to catch my own memory management issues, and while not quite useless, that sort of testing has dropped way down my list of worries the more I lean on LLMs. I am constantly surprised by how many formerly tedious or error prone tasks stopped being either of those, and I expect to see practice shift away from middle-safe languages like C++ to not just much more safe languages like Rust but surprisingly also to much less safe ones like C and platform specific assembly.
mtklein··on C++26 Shipped a SIMD Library Nobody Asked For
Part of that could be ABI constraints. There are some surprising calling convention differences between a vector and a struct or union with vectors in it, and they vary platform to platform. E.g. on ARM a struct with two 128-bit vectors will pass in two registers where on x86 it must pass via the stack.

Using __attribute__ to tweak calling conventions can often really clean this up, but that's just as obscure and non-portable as the problem it fixes. So you either end up writing weird non-portable code one way or weird non-portable code another... Code working with these types doesn't get to benefit from zero-cost abstraction to the degree we're used to with normal scalar code.

mtklein··on Tesla is recalling its cheaper Cybertruck because the wheels might fall off
I hate to admit it, but the Corona "Change your Latitude" ads are what locked it in for me.
mtklein··on It's OK to compare floating-points for equality
what I mean here about NaNs is that from a testing perspective, I want to be able to write a test that expects NaN in the same way that I write other expectations, and you can't do that with ==.

    assert(x == 7);    // fine
    assert(y == NaN);  // never true
    assert(y != y);    // this is what you meant
so this equiv() helper fixes that,

    assert(equiv(x, 7));    // fine
    assert(equiv(y, NaN));  // also fine
now, as far as treating NaNs equivalently, the IEEE 754 float format has a huge number of possible representations of NaN, and if you did something like a bitwise comparison, you might think that 0x7fc00000, 0x7f800001, 0xffc00000, 0x7fc0f00d were all different and not equivalent, but they're all NaNs, and I find that when I'm looking for a NaN, I very rarely care about exactly which one I'm looking at. So checking (x!=x && y!=y) admits any two NaNs as equivalent.
mtklein··on It's OK to compare floating-points for equality
My preference in tests is a little different than just using IEEE 754 ==,

    _Bool equiv(float x, float y) {
        return (x <= y && y <= x)
            || (x != x && y != y);
    }
which both handles NaNs sensibly (all NaNs are equivalent) and won't warn about using == on floats. I find it also easy to remember how to write when starting a new project.
mtklein··on Qwen3.6-35B-A3B: Agentic coding power, now open to all
Yes, it's a "Brain float", basically an ordinary 32-bit float with the low 16 mantissa bits cut off. Exact same range as fp32, lower precision, and not the same as the other fp16, which has less exponent and more mantissa.
mtklein··on Google has the same AI adoption curve as John Deere
The closest term I know is "just-so story".
mtklein··on Waymo Safety Impact
I am also not looking forward to the system transitioning from "big experiment, burn money to make it good" to "established business unit, tweak it to death for incrementally more money / personal promotion." We're still in the honeymoon period and I very much expect to hate Waymo in 10 or 15 years when they reach a steady state.
mtklein··on AVX2 is slower than SSE2-4.x under Windows ARM emulation
If I remember correctly, the AVX2 feature set is a fairly direct upscale of SSE4.1 to 256 bit. Very few instructions even allowed interaction between the top and bottom 128 bits, I assume to make implementation on existing 128 bit vector units easier. And the most notable new things that AVX2 added beyond that widening, fp16 conversion and FMA support, are also present in NEON, so I wouldn't expect that to be the issue either.

So I'd bet the issue is either newness of the codebase, as the article suggests, or perhaps that it is harder to schedule the work in 256 bit chunks than 128. It's got to be easier when you've got more than enough NEON q registers to handle the xmms, harder when you've got only exactly enough to pair up for handling ymms?

mtklein··on Why medieval city-builder video games are historically inaccurate (2020)
I agree with you, but we must admit that The Expanse has all of spaceships bouncing around, explosion sounds, and superhumans.
mtklein··on Framework Laptop 13 gets ARM processor with 12 cores via upgrade kit
This is astonishingly bad power usage for a laptop, a complete dealbreaker: "...early tests show that the SoC already draws about 16 watts at idle..."
mtklein··on LLVM-MOS – Clang LLVM fork targeting the 6502
This was a nice surprise when learning to code for NES, that I could write pretty much normal C and have it work on the 6502. A lot of tutorials warn you, "prepare for weird code" and this pretty much moots that.
mtklein··on Zig is so cool, C is cooler
Zig is so good at this, it is also probably the easiest way to cross-compile C.
mtklein··on CPU cache-friendly data structures in Go
I think this is _Alignas/alignas.

    struct foo {
        _Alignas(64) float x,y;
        _Alignas(64) int     z;
    };
    _Static_assert(sizeof(struct foo) == 192, "");
mtklein··on Laptops create systems. Phones feed algorithms. The asymmetry determines power
I very much used to agree with this, but some time this summer the ChatGPT iOS app started to change this for me. I have definitely had days where I've felt as coding-creative as I can be on a laptop but instead just texting my AI interns to handle the execution while I'm out for a walk.
mtklein··on Walking around the compiler
I don't understand why this article invents and explains a phony ranged-float fix when the real fix from the footnotes would have been just as simple to explain. The deception needlessly undermines the main point of the article, which I completely agree with.
Page 1 of 4Next →