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•1y ago

Comments

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

The Website Specification

https://specification.website/
137•k1m•2h ago•43 comments

London's Free Roof Terraces

https://diamondgeezer.blogspot.com/2026/05/londons-free-roof-terraces.html
30•zeristor•2h ago•3 comments

Domain expertise has always been the real moat

https://www.brethorsting.com/blog/2026/05/domain-expertise-has-always-been-the-real-moat/
578•aaronbrethorst•13h ago•338 comments

Avian Visitors

https://theodore.net/projects/AvianVisitors/
36•fdb•3h ago•5 comments

Shantell Sans (2023)

https://shantellsans.com/process
245•aleda145•11h ago•25 comments

Show HN: Breathe CLI – Paced resonance breathing in the macOS terminal

https://github.com/marekkowalczyk/breathe-cli
24•marekkowalczyk•13h ago•5 comments

A Gentle Introduction to Lattice-Based Cryptography [pdf]

https://cryptography101.ca/wp-content/uploads/lattice-based-cryptography.pdf
81•jayhoon•2d ago•3 comments

I found a seashell in the middle of the desert

https://github.com/Hawzen/I-found-a-seashell-in-the-middle-of-the-desert#i-found-a-seashell-in-th...
324•Hawzen•2d ago•87 comments

The AV2 Video Standard Has Released (Final v1.0 Specification)

https://av2.aomedia.org
197•ksec•11h ago•75 comments

One year of Roto, a compiled scripting language for Rust

https://blog.nlnetlabs.nl/one-year-of-roto-the-compiled-scripting-language-for-rust/
28•Hasnep•1d ago•8 comments

Telli (YC F24) is hiring in engineering, design, and GTM [Berlin, on-site]

https://hi.telli.com/join-us
1•sebselassie•2h ago

A pictorial introduction to differential geometry (2017)

https://arxiv.org/abs/1709.08492
34•ricudis•4h ago•0 comments

Associative learning turns DEET from aversive to appetitive in Aedes aegypti

https://journals.biologists.com/jeb/article/229/10/jeb251935/371741/Associative-learning-switches...
34•croes•2d ago•14 comments

Microsoft Office 2019 and 2021 for Mac view-only conversion

https://consumerrights.wiki/w/Microsoft_Office_2019_and_2021_for_Mac_view-only_conversion_(2026)
846•antipurist•10h ago•299 comments

Mysteries of the Griffin iMate

https://www.projectgus.com/2023/04/griffin-imate/
8•geerlingguy•4d ago•0 comments

Please Do Not Vibe Fuck Up This Software

https://github.com/RsyncProject/rsync/issues/929
217•justdotJS•6h ago•108 comments

Racket v9.2

https://blog.racket-lang.org/2026/05/racket-v9-2.html
117•spdegabrielle•3d ago•14 comments

The dangerous delusion of modern warfare

https://economist.com/interactive/essay/2026/05/28/the-dangerous-delusion-of-modern-warfare
5•runeks•1h ago•1 comments

Accenture to acquire Ookla

https://newsroom.accenture.com/news/2026/accenture-to-acquire-ookla-to-strengthen-network-intelli...
283•Garbage•17h ago•144 comments

Mechanical Pencil: An illustrated celebration of the engineering around us

https://mechanical-pencil.com/
77•Muhammad523•9h ago•8 comments

Ahoy, DECmate II the little PDP-8 that could

http://oldvcr.blogspot.com/2026/05/ahoy-decmate-ii-little-pdp-8-that-could.html
32•TMWNN•5h ago•3 comments

Openrsync: An implementation of rsync, by the OpenBSD team

https://github.com/kristapsdz/openrsync
398•sph•22h ago•153 comments

Voxel Space (2017)

https://s-macke.github.io/VoxelSpace/
283•davikr•19h ago•58 comments

Zig ELF Linker Improvements Devlog

https://ziglang.org/devlog/2026/#2026-05-30
204•kristoff_it•16h ago•69 comments

wolfSSL releases a new product; wolfCOSE a zero alloc C embbedded COSE stack

https://github.com/wolfSSL/wolfCOSE
91•aidangarske•13h ago•18 comments

Jef Raskin, the Visionary Behind the Mac (2013)

https://lowendmac.com/2013/jef-raskin-the-visionary-behind-the-mac/
101•tylerdane•14h ago•45 comments

Parallel Reconstruction of Lawful TLS Wiretapping

https://remyhax.xyz/posts/reproducing-lawful-tls-wiretapping/
98•jerrythegerbil•13h ago•43 comments

Cheese Paper: a text editor specifically designed for writing

https://brie.gay/cheese-paper/
104•sohkamyung•10h ago•27 comments

Pandoc Templates

https://pandoc-templates.org/
394•ankitg12•23h ago•50 comments

OpenRouter raises $113M Series B

https://openrouter.ai/announcements/series-b
418•freeCandy•16h ago•198 comments