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

I’m joining OpenAI

https://steipete.me/posts/2026/openclaw
823•mfiguiere•8h ago•560 comments

Magnus Carlsen Wins the Freestyle (Chess960) World Championship

https://www.fide.com/magnus-carlsen-wins-2026-fide-freestyle-world-championship/
216•prophylaxis•8h ago•129 comments

Arm wants a bigger slice of the chip business

https://www.economist.com/business/2026/02/12/arm-wants-a-bigger-slice-of-the-chip-business
48•andsoitis•3h ago•23 comments

Modern CSS Code Snippets: Stop writing CSS like it's 2015

https://modern-css.com
335•eustoria•12h ago•133 comments

LT6502: A 6502-based homebrew laptop

https://github.com/TechPaula/LT6502
336•classichasclass•13h ago•149 comments

Audio is the one area small labs are winning

https://www.amplifypartners.com/blog-posts/arming-the-rebels-with-gpus-gradium-kyutai-and-audio-ai
159•rocauc•3d ago•29 comments

How long do job postings stay open?

https://corvi.careers/blog/job_open_days_by_category_feb_2026/
17•sp1982•1d ago•13 comments

I gave Claude access to my pen plotter

https://harmonique.one/posts/i-gave-claude-access-to-my-pen-plotter
148•futurecat•2d ago•76 comments

Error payloads in Zig

https://srcreigh.ca/posts/error-payloads-in-zig/
66•srcreigh•7h ago•24 comments

Databases should contain their own Metadata – Use SQL Everywhere

https://floedb.ai/blog/databases-should-contain-their-own-metadata-instrumentation-in-floe
11•matheusalmeida•4d ago•3 comments

I Love Board Games: A Personal Obsession Explained by Psychology

https://www.thesswnetwork.com/post/why-i-love-board-games-a-personal-obsession-explained-by-psych...
36•Propolice•4d ago•23 comments

Show HN: Microgpt is a GPT you can visualize in the browser

https://microgpt.boratto.ca
155•b44•11h ago•13 comments

Transforming a Clojure Database into a Library with GraalVM Native Image and FFI

https://avelino.run/chrondb-polyglot-ffi-clojure-graalvm-native-image/
35•PaulHoule•4d ago•2 comments

Why does aluminum foil have one shiny side and one with a matte finish?

https://bookofjoe2.blogspot.com/2025/10/why-does-aluminum-foil-have-one-shiny.html
7•surprisetalk•4d ago•11 comments

EU bans the destruction of unsold apparel, clothing, accessories and footwear

https://environment.ec.europa.eu/news/new-eu-rules-stop-destruction-unsold-clothes-and-shoes-2026...
859•giuliomagnifico•13h ago•598 comments

Radio host David Greene says Google's NotebookLM tool stole his voice

https://www.washingtonpost.com/technology/2026/02/15/david-greene-google-ai-podcast/
140•mikhael•12h ago•79 comments

Pocketblue – Fedora Atomic for mobile devices

https://github.com/pocketblue/pocketblue
84•nikodunk•13h ago•15 comments

Real-time PathTracing with global illumination in WebGL

https://erichlof.github.io/THREE.js-PathTracing-Renderer/
146•tobr•3d ago•13 comments

Gwtar: A static efficient single-file HTML format

https://gwern.net/gwtar
211•theblazehen•14h ago•70 comments

GNU Pies – Program Invocation and Execution Supervisor

https://www.gnu.org.ua/software/pies/
75•smartmic•9h ago•50 comments

Show HN: Knock-Knock.net – Visualizing the bots knocking on my server's door

https://knock-knock.net
124•djkurlander•13h ago•52 comments

Show HN: VOOG – Moog-style polyphonic synthesizer in Python with tkinter GUI

https://github.com/gpasquero/voog
76•gpasquero•10h ago•24 comments

Editor's Note: Retraction of article containing fabricated quotations

https://arstechnica.com/staff/2026/02/editors-note-retraction-of-article-containing-fabricated-qu...
210•bikenaga•11h ago•151 comments

Amazon's Ring and Google's Nest reveal the severity of U.S. surveillance state

https://greenwald.substack.com/p/amazons-ring-and-googles-nest-unwittingly
771•mikece•17h ago•564 comments

I fixed Windows native development

https://marler8997.github.io/blog/fixed-windows/
713•deevus•19h ago•340 comments

Language a Wood for Thought: Susan Howe's Work

https://www.poetryfoundation.org/articles/1769037/language-a-wood-for-thought
22•apollinaire•4d ago•1 comments

Benchmarking Automatic Typesetting Systems

https://news.speedata.de/2026/02/10/typesetting-benchmark/
12•patrickg•5d ago•4 comments

Towards Autonomous Mathematics Research

https://arxiv.org/abs/2602.10177
90•gmays•11h ago•48 comments

Hideki Sato, designer of all Sega's consoles, has died

https://www.videogameschronicle.com/news/hideki-sato-designer-of-segas-consoles-dies-age-75/
384•magoghm•14h ago•38 comments

Why I don't think AGI is imminent

https://dlants.me/agi-not-imminent.html
64•anonymid•6h ago•140 comments