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

Comments

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

Canvas (Instructure) LMS Down in Ongoing Ransomware Attack

https://www.theverge.com/tech/926458/canvas-shinyhunters-breach
257•stefanpie•4h ago•90 comments

Maybe you shouldn't install new software for a bit

https://xeiaso.net/blog/2026/abstain-from-install/
152•psxuaw•3h ago•76 comments

Dirtyfrag: Universal Linux LPE

https://www.openwall.com/lists/oss-security/2026/05/07/8
435•flipped•7h ago•196 comments

The Disappearance of the Public Bench

https://placesjournal.org/article/the-disappearance-of-the-public-bench/
41•cainxinth•1d ago•25 comments

The Burning Man MOOP Map

https://www.not-ship.com/burning-man-moop/
539•speckx•12h ago•288 comments

Agents need control flow, not more prompts

https://bsuh.bearblog.dev/agents-need-control-flow/
342•bsuh•9h ago•187 comments

Researchers discover advanced language processing in the unconscious human brain

https://www.bcm.edu/news/researchers-discover-advanced-language-processing-in-the-unconscious-hum...
50•hhs•3h ago•15 comments

Building for the Future

https://blog.cloudflare.com/building-for-the-future/
276•PriorityLeft•6h ago•159 comments

Natural Language Autoencoders: Turning Claude's Thoughts into Text

https://www.anthropic.com/research/natural-language-autoencoders
203•instagraham•8h ago•69 comments

ShinyHunters claims data theft from 8,800 schools (Instructure/Canvas)

https://www.bleepingcomputer.com/news/security/instructure-hacker-claims-data-theft-from-8-800-sc...
137•tfirst•6h ago•82 comments

GNU IFUNC is the real culprit behind CVE-2024-3094

https://github.com/robertdfrench/ifuncd-up
20•foltik•2h ago•5 comments

AlphaEvolve: Gemini-powered coding agent scaling impact across fields

https://deepmind.google/blog/alphaevolve-impact/
247•berlianta•11h ago•102 comments

DeepSeek 4 Flash local inference engine for Metal

https://github.com/antirez/ds4
303•tamnd•10h ago•85 comments

Nonprofit hospitals spend billions on consultants with no clear effect

https://www.uchicagomedicine.org/forefront/research-and-discoveries-articles/nonprofit-hospitals-...
73•hhs•3h ago•23 comments

The Traveling Salesdog Problem

https://www.wespiser.com/posts/2026-05-04-traveling-salesdog.html
13•wespiser_2018•2d ago•4 comments

AI slop is killing online communities

https://rmoff.net/2026/05/06/ai-slop-is-killing-online-communities/
461•thm•7h ago•449 comments

Komai: a fine Matrix chat app you can get to love

https://etke.cc/blog/introducing-komai
15•anotherevan•2h ago•5 comments

Two Home Affairs officials suspended after AI 'hallucinations' found

https://www.citizen.co.za/news/home-affairs-officials-suspended-ai-hallucinations/
56•jruohonen•6h ago•15 comments

I want to live like Costco people

https://tastecooking.com/i-want-to-live-like-costco-people/
247•speckx•11h ago•510 comments

Creating for a niche

https://www.davesnider.com/posts/working-in-a-niche
33•snide•6h ago•5 comments

Chrome removes claim of On-device Al not sending data to Google Servers

https://old.reddit.com/r/chrome/comments/1t5qayz/chrome_removes_claim_of_ondevice_al_not_sending/
479•newsoftheday•10h ago•178 comments

Rolling the Root Key

https://blog.apnic.net/2026/05/05/rolling-the-root-key/
23•jandeboevrie•2d ago•2 comments

Tools in the Grass: Raising the next generation of crafts person

https://www.popularwoodworking.com/editors-blog/tools-in-the-grass/
32•NaOH•2d ago•2 comments

Principles for agent-native CLIs

https://twitter.com/trevin/status/2051316002730991795
64•blumpy22•8h ago•33 comments

Gambling ads on social media reach more than twice as many men as women: study

https://www.cam.ac.uk/research/news/gambling-ads-on-social-media-reach-more-than-twice-as-many-me...
8•hhs•3h ago•5 comments

PySimpleGUI 6

https://github.com/PySimpleGUI/PySimpleGUI
92•geophph•2d ago•46 comments

RaTeX: KaTeX-compatible LaTeX rendering engine in pure Rust

https://ratex.lites.dev/
161•atilimcetin•3d ago•88 comments

The Self-Cancelling Subscription

https://predr.ag/blog/the-self-cancelling-subscription/
152•surprisetalk•12h ago•64 comments

Show HN: TRUST – Coding Rust like it's 1989

https://github.com/wojtczyk/trust
125•wojtczyk•20h ago•74 comments

OurCar: What I learned making an app for my family

https://mendelgreenberg.com/posts/ourcar/
102•chabad360•1d ago•73 comments