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

Show HN: A game where you build a GPU

https://jaso1024.com/mvidia/
426•Jaso1024•6h ago•122 comments

How many products does Microsoft have named 'Copilot'?

https://teybannerman.com/strategy/2026/03/31/how-many-microsoft-copilot-are-there.html
311•gpi•3h ago•167 comments

Demand for autism care is soaring

https://economist.com/united-states/2026/04/01/demand-for-autism-care-is-soaring-the-system-is-st...
4•andsoitis•5m ago•0 comments

Embarrassingly simple self-distillation improves code generation

https://arxiv.org/abs/2604.01193
513•Anon84•13h ago•161 comments

Banning All Anthropic Employees

https://joeyh.name/blog/entry/banning_all_Anthropic_employees/
11•edward•36m ago•1 comments

LLM Wiki – example of an "idea file"

https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f
18•tamnd•6h ago•2 comments

Show HN: I made open source, zero power PCB hackathon badges

https://github.com/KaiPereira/Overglade-Badges
24•kaipereira•9h ago•2 comments

Ruckus: Racket for iOS

https://ruckus.defn.io/
50•nsm•2d ago•1 comments

Show HN: sllm – Split a GPU node with other developers, unlimited tokens

https://sllm.cloud
108•jrandolf•8h ago•62 comments

OpenScreen is an open-source alternative to Screen Studio

https://github.com/siddharthvaddem/openscreen
13•jskopek•3d ago•1 comments

Apple approves driver that lets Nvidia eGPUs work with Arm Macs

https://www.theverge.com/tech/907003/apple-approves-driver-that-lets-nvidia-egpus-work-with-arm-macs
326•naves•7h ago•145 comments

Show HN: TurboQuant-WASM – Google's vector quantization in the browser

https://github.com/teamchong/turboquant-wasm
123•teamchong•8h ago•4 comments

The Indie Internet Index – submit your favorite sites

https://iii.social
83•freshman_dev•9h ago•15 comments

German implementation of eIDAS will require an Apple/Google account to function

https://bmi.usercontent.opencode.de/eudi-wallet/wallet-development-documentation-public/latest/ar...
14•DyslexicAtheist•37m ago•1 comments

Components of a Coding Agent

https://magazine.sebastianraschka.com/p/components-of-a-coding-agent
141•MindGods•10h ago•54 comments

Some Unusual Trees

https://thoughts.wyounas.com/p/some-unusual-trees
237•simplegeek•14h ago•69 comments

Emotion concepts and their function in a large language model

https://www.anthropic.com/research/emotion-concepts-function
129•dnw•17h ago•126 comments

The CMS is dead, long live the CMS

https://next.jazzsequence.com/posts/the-cms-is-dead-long-live-the-cms
113•taubek•12h ago•70 comments

IBM 3270 Information Display System: Color and Programmed Symbols (1979) [pdf]

https://bitsavers.org/pdf/ibm/3278/GA33-3056-0_3270_Information_Display_System_Color_and_Programm...
30•hggh•6h ago•8 comments

Electrical Transformer Manufacturing Is Throttling the Electrified Future

https://www.bloomberg.com/features/2025-bottlenecks-transformers/
54•toomuchtodo•3d ago•44 comments

Claude Code Found a Linux Vulnerability Hidden for 23 Years

https://mtlynch.io/claude-code-found-linux-vulnerability/
348•eichin•23h ago•226 comments

Plague Ships (2020)

https://www.afloat.com.au/feature/plague-ships/
33•bryanrasmussen•6h ago•5 comments

Training mRNA Language Models Across 25 Species for $165

102•maziyar•3d ago•27 comments

The Cathedral, the Bazaar, and the Winchester Mystery House

https://www.dbreunig.com/2026/03/26/winchester-mystery-house.html
147•dbreunig•3d ago•52 comments

Sopwith – 1984 Game (2000)

http://www.sopwith.org/
70•elvis70•5h ago•32 comments

Breaking Enigma with Index of Coincidence on a Commodore 64

https://imapenguin.com/2026/03/breaking-enigma-with-index-of-coincidence-on-a-commodore-64/
13•saganus•4d ago•2 comments

Mbodi AI (YC P25) Is Hiring

https://www.ycombinator.com/companies/mbodi-ai/jobs/mf9L3sy-senior-robotics-engineer-systems-cont...
1•chitianhao•11h ago

Scientists observe an immune signaling complex forming inside cells

https://news.stanford.edu/stories/2026/03/immune-response-inside-cells-inflammation-research
82•ohjeez•5h ago•6 comments

Author of "Careless People" banned from saying anything negative about Meta

https://www.thetimes.com/uk/technology-uk/article/sarah-wynn-williams-careless-people-meta-nrffdfpmf
696•macleginn•8h ago•460 comments

Tell HN: Anthropic no longer allowing Claude Code subscriptions to use OpenClaw

1022•firloop•1d ago•772 comments