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•10mo 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...)

Kagi Small Web

https://kagi.com/smallweb/
355•trueduke•4h ago•74 comments

Kagi Translate now supports LinkedIn Speak as an output language

https://translate.kagi.com/?from=en&to=LinkedIn+speak
943•smitec•9h ago•229 comments

Reddit User Uncovers Who Is Behind Meta's $2B Lobbying for Age Verification Tech

https://www.gadgetreview.com/reddit-user-uncovers-who-is-behind-metas-2b-lobbying-for-invasive-ag...
504•doener•3h ago•206 comments

Building a Shell

https://healeycodes.com/building-a-shell
80•ingve•4h ago•17 comments

Silicon Valley's "Pronatalists" Killed WFH. The Strait of Hormuz Brought It Back

https://www.governance.fyi/p/silicon-valleys-pronatalists-killed
77•bigbobbeeper•1h ago•66 comments

Font Smuggler – copy hidden brand fonts into Google Docs

https://brianmoore.com/fontsmuggler/
57•lanewinfield•3d ago•21 comments

Enabling Efficient Sparse Computations Using Linear Algebra Aware Compilers

https://www.osti.gov/biblio/3013883
16•matt_d•4d ago•0 comments

Leanstral: Open-source agent for trustworthy coding and formal proof engineering

https://mistral.ai/news/leanstral
627•Poudlardo•17h ago•139 comments

The unlikely story of Teardown Multiplayer

https://blog.voxagon.se/2026/03/13/teardown-multiplayer.html
154•lairv•3d ago•35 comments

Reverse-engineering Viktor and making it Open Source

https://matijacniacki.com/blog/openviktor
68•zggf•5h ago•22 comments

Ryugu asteroid samples contain all DNA and RNA building blocks

https://phys.org/news/2026-03-ryugu-asteroid-samples-dna-rna.html
43•bookofjoe•2h ago•37 comments

Meta’s renewed commitment to jemalloc

https://engineering.fb.com/2026/03/02/data-infrastructure/investing-in-infrastructure-metas-renew...
468•hahahacorn•19h ago•204 comments

Gummy Geometry

https://newkrok.github.io/nape-js/examples.html?open=soft-body&mode=3d&outline=0
31•memalign•3d ago•4 comments

The American Healthcare Conundrum

https://github.com/rexrodeo/american-healthcare-conundrum
407•rexroad•20h ago•394 comments

The “small web” is bigger than you might think

https://kevinboone.me/small_web_is_big.html
469•speckx•20h ago•199 comments

Sci-Fi Short Film “There Is No Antimemetics Division” [video]

https://www.youtube.com/watch?v=3v8AsTHfAG0
166•Anon84•4d ago•40 comments

How long does it take to get last liquid drops from kitchen containers?

https://www.brown.edu/news/2026-03-04/kitchen-fluid-dynamics
14•hhs•4d ago•4 comments

Finding a CPU Design Bug in the Xbox 360

https://randomascii.wordpress.com/2018/01/07/finding-a-cpu-design-bug-in-the-xbox-360/
3•mariuz•4d ago•0 comments

Every layer of review makes you 10x slower

https://apenwarr.ca/log/20260316
363•greyface-•10h ago•218 comments

A proposal to classify happiness as a psychiatric disorder

https://pmc.ncbi.nlm.nih.gov/articles/PMC1376114/
19•wjSgoWPm5bWAhXB•1h ago•13 comments

US SEC preparing to scrap quarterly reporting requirement

https://www.reuters.com/business/finance/us-sec-preparing-eliminate-quarterly-reporting-requireme...
637•djoldman•14h ago•358 comments

Pyodide: a Python distribution based on WebAssembly

https://github.com/pyodide/pyodide
122•tosh•3d ago•31 comments

Why I love FreeBSD

https://it-notes.dragas.net/2026/03/16/why-i-love-freebsd/
470•enz•1d ago•228 comments

Beyond has dropped “meat” from its name and expanded its high-protein drink line

https://plantbasednews.org/news/alternative-protein/beyond-meat-not-the-moment-rebrand/
162•rmason•17h ago•392 comments

My Journey to a reliable and enjoyable locally hosted voice assistant (2025)

https://community.home-assistant.io/t/my-journey-to-a-reliable-and-enjoyable-locally-hosted-voice...
395•Vaslo•1d ago•119 comments

Gitana 18: the new flying Ultim trimaran

https://www.boatnews.com/story/50717/gitana-18-radical-technical-choices-for-the-new-flying-ultim...
55•divbzero•4d ago•31 comments

Fatal Core Dump Game

https://www.robopenguins.com/core-dump-game/
22•pabs3•4d ago•4 comments

Claude Tips for 3D Work

https://www.davesnider.com/posts/claude-3d
146•snide•3d ago•31 comments

Show HN: Oxyde – Pydantic-native async ORM with a Rust core

https://github.com/mr-fatalyst/oxyde
134•mr_Fatalyst•4d ago•67 comments

Starlink Mini as a failover

https://www.jackpearce.co.uk/posts/starlink-failover/
287•jkpe•1d ago•208 comments