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•11mo 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•11mo 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•11mo 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•11mo 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•11mo 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•11mo ago
in CPU's - pipelining!
jchw•11mo 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...)

Valve releases Steam Controller CAD files under Creative Commons license

https://www.digitalfoundry.net/news/2026/05/valve-releases-steam-controller-cad-files-under-creat...
1083•haunter•10h ago•359 comments

The Vatican's Website in Latin

https://www.vatican.va/latin/latin_index.html
37•ks2048•1h ago•21 comments

Appearing productive in the workplace

https://nooneshappy.com/article/appearing-productive-in-the-workplace/
744•diebillionaires•10h ago•289 comments

The Old Guard: Confronting America's Gerontocratic Crisis

https://harpers.org/archive/2026/05/the-old-guard-samuel-moyn-gerontocracy/
36•Caiero•2h ago•19 comments

Vibe coding and agentic engineering are getting closer than I'd like

https://simonwillison.net/2026/May/6/vibe-coding-and-agentic-engineering/
419•e12e•11h ago•449 comments

From Supabase to Clerk to Better Auth

https://blog.val.town/better-auth
206•stevekrouse•9h ago•133 comments

The bottleneck was never the code

https://www.thetypicalset.com/blog/thoughts-on-coding-agents
518•Anon84•2d ago•337 comments

Google Cloud fraud defense, the next evolution of reCAPTCHA

https://cloud.google.com/blog/products/identity-security/introducing-google-cloud-fraud-defense-t...
214•unforgivenpasta•8h ago•210 comments

Building my own Vi text editor in BASIC

https://leetusman.com/nosebook/yvi
28•zeech•1d ago•12 comments

How do I inform Windows that I'm writing a binary file?

https://devblogs.microsoft.com/oldnewthing/20260504-00/?p=112296
18•ingve•1d ago•18 comments

Learning the Integral of a Diffusion Model

https://sander.ai/2026/05/06/flow-maps.html
97•benanne•7h ago•17 comments

Show HN: Hallucinopedia

http://halupedia.com/
153•bstrama•9h ago•156 comments

Show HN: Tilde.run – Agent sandbox with a transactional, versioned filesystem

https://tilde.run/
129•ozkatz•10h ago•97 comments

Programming Still Sucks

https://www.stvn.sh/writing/programming-still-sucks-fqffhyp
109•jeromechoo•7h ago•18 comments

SQLite Is a Library of Congress Recommended Storage Format

https://sqlite.org/locrsf.html
19•whatisabcdefgh•4h ago•5 comments

Community firmware for the Xteink X4 e-paper reader

https://github.com/crosspoint-reader/crosspoint-reader
49•dmos62•1d ago•20 comments

A Theory of Deep Learning

https://elonlit.com/scrivings/a-theory-of-deep-learning/
130•elonlit•1d ago•28 comments

Inkscape 1.4.4

https://inkscape.org/doc/release_notes/1.4.4/Inkscape_1.4.4.html
221•s1291•6h ago•62 comments

Perturb-MARS: Reading mouse experiments through a human lens

https://www.noetik.blog/p/perturb-mars-reading-mouse-experiments
4•crescit_eundo•2d ago•0 comments

Ted Turner has died

https://www.cnn.com/2026/05/06/us/ted-turner-death
232•pseudolus•11h ago•187 comments

Show HN: I built an open-source email builder, alternative to Beefree/Unlayer

https://play.templatical.com
103•oahmadov•10h ago•24 comments

Show HN: PHP-fts – Full-text search engine in pure PHP, no extensions

https://github.com/olivier-ls/php-fts
32•asmodios•6h ago•7 comments

SoundOff: Low-Cost Passive Ultrasound Tags

https://yibo-fu.com/SoundOff-Low-cost-Passive-Ultrasound-Tags-for-Non-invasive-and-Non
37•jonbaer•9h ago•1 comments

Setting up a Sun Ray server on OpenIndiana Hipster 2025.10

https://catstret.ch/202605/srss-hipster202510/
127•jandeboevrie•15h ago•46 comments

Higher usage limits for Claude and a compute deal with SpaceX

https://www.anthropic.com/news/higher-limits-spacex
394•meetpateltech•10h ago•340 comments

ADT says customer data stolen in cyber intrusion

https://therecord.media/ADT-data-breach-cyberattack
23•PaulHoule•2h ago•4 comments

What makes a good smartphone camera?

https://cadence.moe/blog/2026-05-05-what-makes-a-good-smartphone-camera
82•zdw•1d ago•55 comments

Virtual violin produces realistic sounds

https://news.mit.edu/2026/mit-engineers-virtual-violin-produces-realistic-sounds-0429
79•gmays•3d ago•61 comments

Agents can now create Cloudflare accounts, buy domains, and deploy

https://blog.cloudflare.com/agents-stripe-projects/
628•rolph•23h ago•355 comments

Mickey Mouse is watching you: Disneyland deploys facial recognition

https://www.theguardian.com/us-news/2026/apr/28/disneyland-entrance-facial-recognition
46•Cider9986•5h ago•13 comments