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...)

How NASA built Artemis II’s fault-tolerant computer

https://cacm.acm.org/news/how-nasa-built-artemis-iis-fault-tolerant-computer/
124•speckx•11h ago•41 comments

Native Instant Space Switching on macOS

https://arhan.sh/blog/native-instant-space-switching-on-macos/
344•PaulHoule•7h ago•173 comments

Generative art over the years

https://blog.veitheller.de/Generative_art_over_the_years.html
27•evakhoury•2d ago•2 comments

Charcuterie – Visual similarity Unicode explorer

https://charcuterie.elastiq.ch/
144•rickcarlino•6h ago•24 comments

PicoZ80 – Drop-In Z80 Replacement

https://eaw.app/picoz80/
158•rickcarlino•8h ago•26 comments

RAM Has a Design Flaw from 1966. I Bypassed It [video]

https://www.youtube.com/watch?v=KKbgulTp3FE
37•surprisetalk•2d ago•2 comments

Reverse engineering Gemini's SynthID detection

https://github.com/aloshdenny/reverse-SynthID
118•_tk_•7h ago•43 comments

Will I ever own a zettaflop?

https://geohot.github.io//blog/jekyll/update/2026/01/26/own-a-zettaflop.html
64•surprisetalk•3d ago•35 comments

Microsoft PhotoDNA scanning problem

https://www.elevenforum.com/t/microsoft-photodna-scanning-problem-it-is-comical-now.45961/
83•darkzek•2h ago•34 comments

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

https://www.unfolder.app/
154•codazoda•10h ago•33 comments

Moving from WordPress to Jekyll (and static site generators in general)

https://www.demandsphere.com/blog/rebuilding-demandsphere-with-jekyll-and-claude-code/
50•rgrieselhuber•6h ago•22 comments

Research-Driven Agents: When an agent reads before it codes

https://blog.skypilot.co/research-driven-agents/
142•hopechong•10h ago•46 comments

Many African families spend fortunes burying their dead

https://davidoks.blog/p/how-funerals-keep-africa-poor
147•powera•5h ago•121 comments

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

https://hegel.dev
87•PaulHoule•8h ago•30 comments

Top laptops to use with FreeBSD

https://freebsdfoundation.github.io/freebsd-laptop-testing/
287•fork-bomber•17h ago•163 comments

How Close Is Too Close? Applying Fluid Dynamics Research Methods to PC Cooling

https://www.lttlabs.com/articles/2026/04/04/how-close-is-too-close-applying-fundamental-fluid-dyn...
16•LabsLucas•4d ago•3 comments

I still prefer MCP over skills

https://david.coffee/i-still-prefer-mcp-over-skills/
12•gmays•1h ago•12 comments

Old laptops in a colo as low cost servers

https://colaptop.pages.dev/
164•argentum47•8h ago•92 comments

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

https://braw.dev/blog/2026-04-06-reallocating-100-month-claude-spend/
305•kisamoto•18h ago•207 comments

Apple's New iPhone Update Is Restricting Internet Freedom in the UK

https://bigbrotherwatch.org.uk/blog/apples-new-iphone-update-is-restricting-internet-freedom-in-t...
8•josephcsible•2h ago•0 comments

Introduction to Nintendo DS Programming

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

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

https://github.com/randerson112/craft
125•randerson_112•11h ago•112 comments

The Training Example Lie Bracket

https://pbement.com/posts/lie_brackets/
18•pb1729•5h ago•10 comments

A WebGPU implementation of Augmented Vertex Block Descent

https://github.com/jure/webphysics
128•juretriglav•15h ago•15 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
192•eigenspace•17h ago•122 comments

Microsoft is employing dark patterns to goad users into paying for storage?

https://lzon.ca/posts/other/microsoft-user-abuse/
239•jpmitchell•6h ago•136 comments

Show HN: Druids – Build your own software factory

https://github.com/fulcrumresearch/druids
27•etherio•1d ago•5 comments

EFF is leaving X

https://www.eff.org/deeplinks/2026/04/eff-leaving-x
1172•gregsadetsky•10h ago•986 comments

LittleSnitch for Linux

https://obdev.at/products/littlesnitch-linux/index.html
1279•pluc•1d ago•415 comments

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

https://www.relvy.ai
40•behat•14h ago•22 comments