HNHacker News
TopNewBestAskShowJobs

aamargulies

200 karma · joined November 3, 2011

submissionscomments
aamargulies··on I struggle to believe that AI R&D is ingenious
Not hard: Number theory.
aamargulies··on Astroterm: A Planetarium for Your Terminal
Some nice arguments:

astroterm -cub --city=Seattle -t 2 -l 2

aamargulies··on Can you use autoregressive diffusion to generate market data?
Seconded.
aamargulies··on Show HN: I made a Raspberry with Qwen my local car AI
Qwen3.5-4B would be a good (better?) candidate. It uses a gated, deltanet hybrid, so your KV cache stays nearly flat as context grows, important for RAM-constrained environments like the Pi.
aamargulies··on Opus 5.0 drives incoherence into the stratosphere
I was playing around with Opus 5.0, experimenting with creative writing tasks and this came out of one of the characters' mouths:

     "... and the reason he was doing this — the reason, the entire load-bearing reason, the twelve thousand dollars a school and the girls of the Karakoram ... "
The em-dash. The 'load-bearing'. Other than that, Opus 5.0 is actually not bad as a writer.
aamargulies··on Ask HN: What are you working on? (August 2026)
Chicago is there! Look in the cities dropdown menu. getting sources is the trick… I’ve made some discoveries about how to ‘reverse-engineer’ a city.
aamargulies··on Ask HN: What are you working on? (August 2026)
Automatic local events aggregator https://whatson.town/
aamargulies··on DuckDB Internals Part 1
I asked Claude which tools it would most want to add to a machine we were working on. #1 was DuckDB.
aamargulies··on You can beat the binary search
Here's my version with a key spline improvement. I should really write this up...

#include <stdbool.h> #include <stdint.h> #include <arm_neon.h>

/* Author: aam@fastmail.fm * * Apple M4 Max (P-core) variant of simd_quad which uses a key spline * to great effect (blog post summary incoming!) / bool simd_quad_m4(const uint16_t carr, int32_t cardinality, uint16_t pos) { enum { gap = 64 };

    if (cardinality < gap) {
        if (cardinality >= 32) {
            // 32 <= n < 64: NEON-compare the first 32 as a single x4 load,
            // sweep the remainder.
            uint16x8_t needle = vdupq_n_u16(pos);
            uint16x8x4_t v = vld1q_u16_x4(carr);
            uint16x8_t hit = vorrq_u16(
                vorrq_u16(vceqq_u16(v.val[0], needle), vceqq_u16(v.val[1], needle)),
                vorrq_u16(vceqq_u16(v.val[2], needle), vceqq_u16(v.val[3], needle)));
            if (vmaxvq_u16(hit) != 0) return true;
            for (int32_t j = 32; j < cardinality; j++) {
                uint16_t x = carr[j];
                if (x >= pos) return x == pos;
            }
            return false;
        }
        if (cardinality >= 16) {
            // 16 <= n < 32: paired x2 load + sweep tail.
            uint16x8_t needle = vdupq_n_u16(pos);
            uint16x8x2_t v = vld1q_u16_x2(carr);
            uint16x8_t hit = vorrq_u16(vceqq_u16(v.val[0], needle),
                                       vceqq_u16(v.val[1], needle));
            if (vmaxvq_u16(hit) != 0) return true;
            for (int32_t j = 16; j < cardinality; j++) {
                uint16_t x = carr[j];
                if (x >= pos) return x == pos;
            }
            return false;
        }
        if (cardinality >= 8) {
            // 8 <= n < 16: single 128-bit compare + sweep tail.
            uint16x8_t needle = vdupq_n_u16(pos);
            uint16x8_t v = vld1q_u16(carr);
            if (vmaxvq_u16(vceqq_u16(v, needle)) != 0) return true;
            for (int32_t j = 8; j < cardinality; j++) {
                uint16_t x = carr[j];
                if (x >= pos) return x == pos;
            }
            return false;
        }
        for (int32_t j = 0; j < cardinality; j++) {
            uint16_t v = carr[j];
            if (v >= pos) return v == pos;
        }
        return false;
    }

    int32_t num_blocks = cardinality / gap;
    int32_t base = 0;
    int32_t n = num_blocks;

    while (n > 3) {
        int32_t quarter = n >> 2;
        int32_t k1 = carr[(base + quarter + 1) * gap - 1];
        int32_t k2 = carr[(base + 2 * quarter + 1) * gap - 1];
        int32_t k3 = carr[(base + 3 * quarter + 1) * gap - 1];
        int32_t c1 = (k1 < pos);
        int32_t c2 = (k2 < pos);
        int32_t c3 = (k3 < pos);
        base += (c1 + c2 + c3) * quarter;
        n -= 3 * quarter;
    }
    while (n > 1) {
        int32_t half = n >> 1;
        base = (carr[(base + half + 1) * gap - 1] < pos) ? base + half : base;
        n -= half;
    }
    int32_t lo = (carr[(base + 1) * gap - 1] < pos) ? base + 1 : base;

    if (lo < num_blocks) {
        const uint16_t *blk = carr + lo * gap;
        uint16x8_t needle = vdupq_n_u16(pos);
        uint16x8x4_t a = vld1q_u16_x4(blk);
        uint16x8x4_t b = vld1q_u16_x4(blk + 32);
        uint16x8_t h0 = vorrq_u16(
            vorrq_u16(vceqq_u16(a.val[0], needle), vceqq_u16(a.val[1], needle)),
            vorrq_u16(vceqq_u16(a.val[2], needle), vceqq_u16(a.val[3], needle)));
        uint16x8_t h1 = vorrq_u16(
            vorrq_u16(vceqq_u16(b.val[0], needle), vceqq_u16(b.val[1], needle)),
            vorrq_u16(vceqq_u16(b.val[2], needle), vceqq_u16(b.val[3], needle)));
        return vmaxvq_u16(vorrq_u16(h0, h1)) != 0;
    }

    for (int32_t j = num_blocks * gap; j < cardinality; j++) {
        uint16_t v = carr[j];
        if (v >= pos) return v == pos;
    }
    return false;
}

/* * Spine variant, M4 edition. * * pack the interpolation probe keys into a dense contiguous region so the * cold-cache pointer chase streams through consecutive cache lines: * * n=4096 -> 64 spine keys -> 128 B = 1 M4 cache line * n=2048 -> 32 spine keys -> 64 B = half a line * n=1024 -> 16 spine keys -> 32 B * * The entire interpolation phase for a max-sized Roaring container now * lives in one cache line. The final SIMD block check still loads from * carr. * * The num_blocks <= 3 fallback: * with very few blocks the carr-based probes accidentally prime the final * block's lines, which the spine path disrupts. / bool simd_quad_m4_spine(const uint16_t carr, const uint16_t spine, int32_t cardinality, uint16_t pos) { enum { gap = 64 };

    if (cardinality < gap) {
        // Same fast paths as simd_quad_m4 -- spine is irrelevant here.
        if (cardinality >= 32) {
            uint16x8_t needle = vdupq_n_u16(pos);
            uint16x8x4_t v = vld1q_u16_x4(carr);
            uint16x8_t hit = vorrq_u16(
                vorrq_u16(vceqq_u16(v.val[0], needle), vceqq_u16(v.val[1], needle)),
                vorrq_u16(vceqq_u16(v.val[2], needle), vceqq_u16(v.val[3], needle)));
            if (vmaxvq_u16(hit) != 0) return true;
            for (int32_t j = 32; j < cardinality; j++) {
                uint16_t x = carr[j];
                if (x >= pos) return x == pos;
            }
            return false;
        }
        if (cardinality >= 16) {
            uint16x8_t needle = vdupq_n_u16(pos);
            uint16x8x2_t v = vld1q_u16_x2(carr);
            uint16x8_t hit = vorrq_u16(vceqq_u16(v.val[0], needle),
                                       vceqq_u16(v.val[1], needle));
            if (vmaxvq_u16(hit) != 0) return true;
            for (int32_t j = 16; j < cardinality; j++) {
                uint16_t x = carr[j];
                if (x >= pos) return x == pos;
            }
            return false;
        }
        if (cardinality >= 8) {
            uint16x8_t needle = vdupq_n_u16(pos);
            uint16x8_t v = vld1q_u16(carr);
            if (vmaxvq_u16(vceqq_u16(v, needle)) != 0) return true;
            for (int32_t j = 8; j < cardinality; j++) {
                uint16_t x = carr[j];
                if (x >= pos) return x == pos;
            }
            return false;
        }
        for (int32_t j = 0; j < cardinality; j++) {
            uint16_t v = carr[j];
            if (v >= pos) return v == pos;
        }
        return false;
    }

    int32_t num_blocks = cardinality / gap;

    if (num_blocks <= 3) {
        return simd_quad_m4(carr, cardinality, pos);
    }

    int32_t base = 0;
    int32_t n = num_blocks;

    // Pull the whole spine into L1 up front. For n in [256, 4096] this is
    // 1 line (128 B); for smaller n it is a partial line. Cheap on cold.
    __builtin_prefetch(spine);

    while (n > 3) {
        int32_t quarter = n >> 2;
        int32_t k1 = spine[base + quarter];
        int32_t k2 = spine[base + 2 * quarter];
        int32_t k3 = spine[base + 3 * quarter];
        int32_t c1 = (k1 < pos);
        int32_t c2 = (k2 < pos);
        int32_t c3 = (k3 < pos);
        base += (c1 + c2 + c3) * quarter;
        n -= 3 * quarter;
    }
    while (n > 1) {
        int32_t half = n >> 1;
        base = (spine[base + half] < pos) ? base + half : base;
        n -= half;
    }
    int32_t lo = (spine[base] < pos) ? base + 1 : base;

    if (lo < num_blocks) {
        const uint16_t *blk = carr + lo * gap;
        uint16x8_t needle = vdupq_n_u16(pos);
        uint16x8x4_t a = vld1q_u16_x4(blk);
        uint16x8x4_t b = vld1q_u16_x4(blk + 32);
        uint16x8_t h0 = vorrq_u16(
            vorrq_u16(vceqq_u16(a.val[0], needle), vceqq_u16(a.val[1], needle)),
            vorrq_u16(vceqq_u16(a.val[2], needle), vceqq_u16(a.val[3], needle)));
        uint16x8_t h1 = vorrq_u16(
            vorrq_u16(vceqq_u16(b.val[0], needle), vceqq_u16(b.val[1], needle)),
            vorrq_u16(vceqq_u16(b.val[2], needle), vceqq_u16(b.val[3], needle)));
        return vmaxvq_u16(vorrq_u16(h0, h1)) != 0;
    }

    for (int32_t j = num_blocks * gap; j < cardinality; j++) {
        uint16_t v = carr[j];
        if (v >= pos) return v == pos;
    }
    return false;
}

// Build the spine for a given carr. Caller allocates cardinality/64 u16s. void simd_quad_m4_build_spine(const uint16_t carr, int32_t cardinality, uint16_t spine) { enum { gap = 64 }; int32_t num_blocks = cardinality / gap; for (int32_t i = 0; i < num_blocks; i++) { spine[i] = carr[(i + 1) gap - 1]; } }

aamargulies··on Trump says Venezuela’s Maduro captured after strikes
Hey, show some respect, you’re talking about the first ever winner of the prestigious FIFA peace prize!
aamargulies··on Tesla changes meaning of 'Full Self-Driving', gives up on promise of autonomy
I knew that FSD was nonsense when I tried to use Tesla's autopark feature under optimal conditions and it failed to park the car satisfactorily.
aamargulies··on Avi Loeb: Is 3I/Atlas Our Turing Test by a Superior Alien Intelligence?
https://youtu.be/aY985qzn7oI?si=PeS4Fn8G_6T7Iu79

Angela Collier has the final word on physics and crackpots. Hilarious.

aamargulies··on Hit men aren't what you think
You’re being facetious, but Peter Singer made this exact point about “ordinary people being evil” in a famous philosophy essay in 1972.

https://youtu.be/KVl5kMXz1vA?si=F__kWUXkcu4h-5iI

aamargulies··on Installed an open source garage door opener, and I'm loving it
OK, nerd sniped.

I bought an OpenGarage and then saw that it had MQTT integration. So... installed MQTT and got that working.

Then asked how hard would it be to hook this up to Alexa and get voice control working? Not toooooo hard ... working.

Then... how hard to get all of my home automation IOT/OAUTHish stuff integrated into MQTT+Alexa? ... a fair bit of work, but .... done!

So, now MQTT is the heart of a system that can talk to my tempest weather station, Tesla, sprinklers, opengarage, ecobee, sense, flume, smartthings controller, all queryable and controllable via voice.

Amazing what is possible these days.

aamargulies··on Letters by Oliver Sacks review
I was lucky enough to attend a lecture given by Dr. Sacks circa 1988. He was a resident speaker for the University of California campuses and had come to UCSC to talk about Awakenings and other topics. He was such a sensitive, kind, gentle person.

It was a privilege to simply be in the audience and the audience was very small. For some reason students didn't take advantage of the opportunity, right in front of them, to come and see him speak. Baffling.

When I saw him, he was in his mid-fifties and the picture of an English academic doctor/professor. It is a kick to see what he looked like in 1961. That BMW he's sitting on is a classic.

The world lost a very special person when he died in 2015.

aamargulies··on The Netherlands has returned some stolen artifacts to Indonesia
Acaster’s brilliant, funny bit on this:

https://youtu.be/x73PkUvArJY?si=eRB3RIuR7rjXvw_i

aamargulies··on Jockey Can't Walk After Manufacturer Refuses to Fix Battery in $100k Exoskeleton
https://www.amazon.com/Lumenier-460mAh-45c-Lipo-Battery/dp/B...

Done.

aamargulies··on Should the richest 1% – who gained $42T/decade – be taxed more?
Yes.

His most important point though is that things will not get better until a sufficient mass of public political pressure is brought to bear on the issue.

aamargulies··on Should the richest 1% – who gained $42T/decade – be taxed more?
The poor keep voting against their own interests and installing Republican/Tory governments that work to actively increase inequality:

https://www.youtube.com/watch?v=mn4daYJzyls

https://www.youtube.com/watch?v=jwqQvrqunp8

aamargulies··on Should the richest 1% – who gained $42T/decade – be taxed more?
Wealth inequality is tipping our country into oligarchy.
aamargulies··on Should the richest 1% – who gained $42T/decade – be taxed more?
Here's perhaps a better link: Robert Reich refutes the top 12 myths about taxing the rich:

https://youtu.be/pnoLAMHwf2I?si=SApa_u3PGUZ-Y150

aamargulies··on Should the richest 1% – who gained $42T/decade – be taxed more?
Yes.
aamargulies··on Should the richest 1% – who gained $42T/decade – be taxed more?
A common objection is that the rich will 'just move' to avoid taxes. However, he goes in depth in his response, pointing out that the source of the wealth can't move, you tax that at the source.

https://youtu.be/t9l7AYl0jUE?si=LUU_8mUpxw0upPk4

aamargulies··on Should the richest 1% – who gained $42T/decade – be taxed more?
Gary Stevenson, former top Citibank London trader, has a YouTube channel centered on taxing the rich as a solution to wealth inequality.

Highly recommended.

https://youtu.be/jFHGiq063rA?si=N64KIhk8ezl7tEEm

aamargulies··on Is 'No tax on tips' a distraction from the fight to end sub-minimum wages?
Topics like these are a footnote in the fight against wealth inequality, a fight we’re losing to the rich.

Gary Stevenson is doing hero’s work on this subject and it is the whale in the room for everyone’s financial well-being.

https://youtu.be/TflnQb9E6lw?si=tzUGGC5xektyU9kc

aamargulies··on Living Computers Museum to permanently close, auction vintage items
Perhaps this is a case of the opposite of love being indifference not hate.
aamargulies··on Retired detective: We got it wrong in Robert Roberson's death penalty case
This isn't the first time Texas has done something like this.

https://deathpenaltyinfo.org/stories/was-an-innocent-man-exe...

aamargulies··on Why did Tom Lehrer swap fame for obscurity?
I took Nature of Math from Lehrer in the 90s. He said on the first day of class that the class was for non-STEM majors and if any of us were science majors he’d find us and kick us out.

I was a science major and I said to myself “Adam, I don’t care what Tom Lehrer says, there’s no way you you’re not taking a math class from Tom Lehrer.”

He was bluffing. I stayed and loved every minute of it.

aamargulies··on Consistency LLM: converting LLMs to parallel decoders accelerates inference 3.5x
I had an interesting experience in an Invertebrate Zoology lab class one summer.

We students were brought into a lab, given specimens to draw, and the only instructions we received were 'You have 30 minutes to draw this. Go.'

There was no "here's how to draw. here's what to do and not to do". It was just basically "We don't care about any insecurities you might have. We don't care if you think you can't draw. No excuses, just fucking draw it. Now."

Not only did we draw, but we (all of us) improved enormously over the course of the class as more animals were brought in and the exercise was repeated over and over and over again throughout the summer.

What it taught us is that everyone, and I mean everyone, can draw. Our collective attitude shifted from "don't know if this is even possible" to "of course we can do this. this is easy. routine. trivial."

Highly recommended approach.

It was the most freeing and amazing class I had in college.

aamargulies··on LLVM Is Smarter Than Me
sum of i: 0,n = n(n+1)/2 not n(n-1)/2
Page 1 of 2Next →