frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

The Scalar Select Anti-Pattern

https://matklad.github.io/2025/05/14/scalar-select-aniti-pattern.html
47•goranmoomin•11mo ago

Comments

castratikron•10mo ago
As long as processing one event does not affect any of the other events in the batch. E.g. events are file IO, and processing one event causes another event's descriptor to get closed before that event can be processed.
wahern•10mo ago
If the close routine on an event source, or the low-level (e.g. epoll) registration, deregistration, and dequeueing logic doesn't know how to keep polling and liveness state consistent between userspace and the kernel, they've got much bigger problems. This looks like Rust code so I would hope the event stream libraries are, e.g., keeping Rc'd file objects and properly managing reference integrity viz-a-viz kernel state before the application caller ever sees the first dequeued event in a cycle. This is a perennial issue with event loop libraries and buggy application code (in every language). One can't just deal with raw file descriptors, call the close syscall directly, etc, hoping to keep state consistent implicitly. There's an unavoidable tie-in needed between application's wrappers around low-level resources and the event loop in use.
taeric•10mo ago
I'm not entirely clear on what the proposal is at the end? Seems that the long term answer as to "which of these implications to pursue" is "all of them?" Simply taking in a batch of instructions doesn't immediately change much? You still have to be able to do each of the other things. And you will still expect some dependencies between batches that could possibly interact in the same ways.

In a sense, this is no different than how your processor is dealing with instructions coming in. You will have some instructions that can be run without waiting on previous ones. You will have some that can complete quickly. You will have some that are stalled on other parts of the system. (I'm sure I could keep wording an instruction to match each of the implications.)

To that end, part of your program has to deal with taking off "whats next" and finding how to prepare that to pass to the execution portion of your program. You can make that only take in batches, but you are almost certainly responsible for how you chunk them moreso than whatever process is sending the instructions to you? Even if you are handed clear batches, it is incumbent on you to batch them as they go off to the rest of the system.

lmz•10mo ago
I guess the proposal is "instead of fetching and acting on one event at a time, consider fetching all available events and look for opportunities to optimize which ones you process (e.g. by prioritization or by skipping certain events if superseded by newer ones)".
taeric•10mo ago
I mean, I got that. But you could as easily say "instead of fetching and acting on one event at a time, fetch and triage/route instructions into applicable queues."

In particular, there is no guarantee that moving to batches changes any of the problems you may have from acting on a single one at a time. To that end, you will have to look into all of the other strategies sooner or later.

Following from that, the problem is not "processMessage" or whatever. The problem is that you haven't broken "processMessage" up into the constituent "receive/triage/process/resolve" loop that you almost certainly will have to end up with.

malkia•10mo ago
in CPU's - pipelining!
jchw•10mo ago
I believe something similar is going on internally in Windows with event queues. It coalesces and prioritizes input events when multiple of them pile up before you're able to pop new events off of the queue. (For some events, e.g. pointer events, you can even go and query frames that were coalesced during input handling.) On the application/API end, it just looks like a "scalar select" loop, but actually it is doing batching behavior for input events!

(On the flip side, if you have a Wayland client that falls behind on processing its event queue, it can crash. On the whole this isn't really that bad but if you have something sending a shit load of events it can cause very bad behavior. This has made me wonder if it's possible, with UNIX domain sockets, to implement some kind of event coalescing on the server-side, to avoid flooding the client with high-precision pointer movement events while it's falling behind. Maybe start coalescing when FIONREAD gets to some high watermark? No idea...)

Native Instant Space Switching on macOS

https://arhan.sh/blog/native-instant-space-switching-on-macos/
67•PaulHoule•1h ago•31 comments

Maine Is About to Become the First State to Ban Major New Data Centers

https://www.gadgetreview.com/maine-is-about-to-become-the-first-state-to-ban-major-new-data-centers
110•rmason•1h ago•129 comments

Netflix Prices Went Up Again – I Bought a DVD Player Instead

https://aywren.com/2026/04/09/netflix-prices-went-up-again-i-bought-a-dvd-player-instead/
80•speckx•37m ago•83 comments

PicoZ80 – Drop-In Z80 Replacement

https://eaw.app/picoz80/
63•rickcarlino•2h ago•10 comments

Hegel, a universal property-based testing protocol and family of PBT libraries

https://hegel.dev
54•PaulHoule•2h ago•17 comments

Old laptops in a colo as low cost servers

https://colaptop.pages.dev/
46•argentum47•2h ago•29 comments

Discovering, detecting, and surgically removing Google's AI watermark

https://github.com/aloshdenny/reverse-SynthID
17•_tk_•44m ago•0 comments

The Future of Everything Is Lies, I Guess: Part 3 – Culture

https://aphyr.com/posts/413-the-future-of-everything-is-lies-i-guess-culture
56•aphyr•7h ago•43 comments

Research-Driven Agents: What Happens When Your Agent Reads Before It Codes

https://blog.skypilot.co/research-driven-agents/
75•hopechong•3h ago•36 comments

Unfolder for Mac – A 3D model unfolding tool for creating papercraft

https://www.unfolder.app/
65•codazoda•3h ago•10 comments

Bitmap fonts make computers feel like computers again

https://korigamik.dev/blog/bitmap_fonts/
48•speckx•1h ago•34 comments

Charcuterie – Visual similarity Unicode explorer

https://charcuterie.elastiq.ch/
10•rickcarlino•43m ago•1 comments

Show HN: I built a Cargo-like build tool for C/C++

https://github.com/randerson112/craft
91•randerson_112•4h ago•81 comments

Top laptops to use with FreeBSD

https://freebsdfoundation.github.io/freebsd-laptop-testing/
237•fork-bomber•11h ago•133 comments

Little Snitch comes to Linux, but the core logic is closed source

https://the.unknown-universe.co.uk/privacy-security/little-snitch-linux/
44•TheIPW•4h ago•16 comments

EFF is leaving X

https://www.eff.org/deeplinks/2026/04/eff-leaving-x
802•gregsadetsky•3h ago•696 comments

OpenAI puts Stargate UK on ice, blames energy costs and red tape

https://www.theregister.com/2026/04/09/openai_puts_stargate_uk_on/
38•Bender•1h ago•17 comments

Reallocating $100/Month Claude Code Spend to Zed and OpenRouter

https://braw.dev/blog/2026-04-06-reallocating-100-month-claude-spend/
245•kisamoto•11h ago•176 comments

Introduction to Nintendo DS Programming

https://www.patater.com/files/projects/manual/manual.html
189•medbar•1d ago•35 comments

A WebGPU implementation of Augmented Vertex Block Descent

https://github.com/jure/webphysics
108•juretriglav•8h ago•14 comments

Wit, unker, Git: The lost medieval pronouns of English intimacy

https://www.bbc.com/future/article/20260408-the-extinct-english-words-for-just-the-two-of-us
163•eigenspace•10h ago•99 comments

Meta removes ads for social media addiction litigation

https://www.axios.com/2026/04/09/meta-social-media-addiction-ads
484•giuliomagnifico•7h ago•195 comments

Doing Impressions: Monet's Early Caricatures (ca. late 1850s)

https://publicdomainreview.org/collection/claude-monet-caricatures/
36•prismatic•3d ago•1 comments

Show HN: CSS Studio. Design by hand, code by agent

https://cssstudio.ai
123•SirHound•9h ago•86 comments

Open source security at Astral

https://astral.sh/blog/open-source-security-at-astral
338•vinhnx•16h ago•91 comments

Building a framework-agnostic Ruby gem (and making sure it doesn't break)

https://newsletter.masilotti.com/p/on-building-a-framework-agnostic
45•joemasilotti•2d ago•6 comments

Aggro Is the Foundation (2022)

https://radimentary.wordpress.com/2022/11/07/aggro-is-the-foundation/
12•surprisetalk•6d ago•1 comments

Things I learned from Reddit fashion

https://acesounderglass.com/2026/01/25/things-i-learned-from-reddit-fashion/
15•surprisetalk•2d ago•2 comments

Help Keep Thunderbird Alive

https://updates.thunderbird.net/en-US/thunderbird/140.0/apr26-1e/donate/
451•playfultones•13h ago•321 comments

Launch HN: Relvy (YC F24) – On-call runbooks, automated

https://www.relvy.ai
35•behat•8h ago•22 comments