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•9mo ago

Comments

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

Meta’s AI smart glasses and data privacy concerns

https://www.svd.se/a/K8nrV4/metas-ai-smart-glasses-and-data-privacy-concerns-workers-say-we-see-e...
982•sandbach•9h ago•560 comments

British Columbia is permanently adopting daylight time

https://www.cbc.ca/news/canada/british-columbia/b-c-adopting-year-round-daylight-time-9.7111657
744•ireflect•11h ago•372 comments

Daily Driving GrapheneOS

https://blog.matthewbrunelle.com/8-4-months-of-daily-driving-grapheneos/
71•zdw•2h ago•35 comments

Ars Technica fires reporter after AI controversy involving fabricated quotes

https://futurism.com/artificial-intelligence/ars-technica-fires-reporter-ai-quotes
218•danso•6h ago•135 comments

Simple screw counter

https://mitxela.com/projects/screwcounter
94•jk_tech•2d ago•21 comments

I built a pint-sized Macintosh

https://www.jeffgeerling.com/blog/2026/pint-sized-macintosh-pico-micro-mac/
8•ingve•55m ago•0 comments

Show HN: I built a sub-500ms latency voice agent from scratch

https://www.ntik.me/posts/voice-agent
359•nicktikhonov•10h ago•103 comments

Buckle Up for Bumpier Skies

https://www.newyorker.com/magazine/2026/03/09/buckle-up-for-bumpier-skies
20•littlexsparkee•2h ago•4 comments

Intent-Based Commits

https://github.com/adamveld12/ghost
40•adamveld12•3h ago•27 comments

Moldova broke our data pipeline

https://www.avraam.dev/blog/moldova-broke-our-pipeline
38•almonerthis•2d ago•26 comments

Physicists developing a quantum computer that’s entirely open source

https://physics.aps.org/articles/v19/24
93•tzury•8h ago•20 comments

First in-utero stem cell therapy for fetal spina bifida repair is safe: study

https://health.ucdavis.edu/news/headlines/first-ever-in-utero-stem-cell-therapy-for-fetal-spina-b...
293•gmays•17h ago•51 comments

DOS Memory Management

https://www.os2museum.com/wp/dos-memory-management/
27•ingve•2d ago•0 comments

New iPad Air, powered by M4

https://www.apple.com/newsroom/2026/03/apple-introduces-the-new-ipad-air-powered-by-m4/
376•Garbage•17h ago•601 comments

Guilty Displeasures

https://www.hopefulmons.com/p/what-are-your-guilty-displeasures
58•aregue•1d ago•62 comments

Seed of Might Color Correction Process (2023) [pdf]

https://andrewvanner.github.io/som/SoM_CC_Process_Day.pdf
84•haunter•9h ago•20 comments

Launch HN: OctaPulse (YC W26) – Robotics and computer vision for fish farming

97•rohxnsxngh•15h ago•33 comments

Elevated Errors in Claude.ai

https://status.claude.com/incidents/yf48hzysrvl5
95•LostMyLogin•4h ago•83 comments

Motorola announces a partnership with GrapheneOS

https://motorolanews.com/motorola-three-new-b2b-solutions-at-mwc-2026/
2169•km•1d ago•793 comments

Guido van Rossum Interviews Thomas Wouters (Python Core Dev)

https://gvanrossum.github.io/interviews/Thomas.html
15•azhenley•1d ago•1 comments

The Cathode Ray Tube site

https://www.crtsite.com/didactic-crt.html
40•joebig•1d ago•3 comments

iPhone 17e

https://www.apple.com/newsroom/2026/03/apple-introduces-iphone-17e/
259•meetpateltech•17h ago•365 comments

Show HN: Govbase – Follow a bill from source text to news bias to social posts

https://govbase.com
187•foxfoxx•14h ago•76 comments

Against Query Based Compilers

https://matklad.github.io/2026/02/25/against-query-based-compilers.html
60•surprisetalk•1d ago•33 comments

I built an RGB controller with Arduino

https://svana.name/2026/02/i-built-an-rgb-controller-with-arduino/
5•msvana•2d ago•0 comments

Inside the M4 Apple Neural Engine, Part 1: Reverse Engineering

https://maderix.substack.com/p/inside-the-m4-apple-neural-engine
322•zdw•1d ago•92 comments

RCade: Building a Community Arcade Cabinet

https://www.frankchiarulli.com/blog/building-the-rcade/
78•evakhoury•4d ago•14 comments

The 185-Microsecond Type Hint

https://blog.sturdystatistics.com/posts/type_hint/
66•kianN•9h ago•8 comments

Ask HN: Who is hiring? (March 2026)

205•whoishiring•16h ago•237 comments

Programmable Cryptography (2024)

https://0xparc.org/writings/programmable-cryptography-1
65•fi-le•2d ago•37 comments