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

Comments

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

Banning Things for Other People Is Easy

https://dogdogfish.com/blog/2026/01/14/banning-things-for-other-people/
25•matthewsharpe3•1h ago•6 comments

A letter to those who fired tech writers because of AI

https://passo.uno/letter-those-who-fired-tech-writers-ai/
139•theletterf•5h ago•75 comments

The URL shortener that makes your links look as suspicious as possible

https://creepylink.com/
479•dreadsword•9h ago•91 comments

Show HN: I modeled personal success as a control system with Bayesian priors

https://mondonno.github.io/successus/sample-h1.html
8•mondonno•42m ago•0 comments

The 500k-ton typo: Why data center copper math doesn't add up

https://investinglive.com/news/the-500000-ton-typo-why-data-center-copper-math-doesnt-add-up-2026...
7•thebeardisred•17m ago•0 comments

Raspberry Pi's New AI Hat Adds 8GB of RAM for Local LLMs

https://www.jeffgeerling.com/blog/2026/raspberry-pi-ai-hat-2/
132•ingve•4h ago•95 comments

Claude Cowork exfiltrates files

https://www.promptarmor.com/resources/claude-cowork-exfiltrates-files
715•takira•16h ago•318 comments

Jiga (YC W21) Is Hiring Full Stack Engineers

https://jiga.io/about-us
1•grmmph•1h ago

Z80 Mem­ber­ship Card

https://sunrise-ev.com/z80.htm
39•exvi•3d ago•7 comments

Photos Capture the Breathtaking Scale of China's Wind and Solar Buildout

https://e360.yale.edu/digest/china-renewable-photo-essay
163•mrtksn•3h ago•89 comments

Test Your Square Brackets

https://fluca1978.github.io/2025/12/10/testAndSquareBrackets.html
19•speckx•5d ago•8 comments

Ask HN: How are you doing RAG locally?

215•tmaly•22h ago•85 comments

San Remo Pasta Measurer

https://www.toxel.com/tech/2025/09/17/san-remo-pasta-measurer/
21•surprisetalk•5d ago•7 comments

Show HN: MailPilot – Freedom to go anywhere while your agents work

11•keepamovin•5h ago•11 comments

Ask HN: Share your personal website

669•susam•20h ago•1862 comments

Handy – Free open source speech-to-text app

https://github.com/cjpais/Handy
126•tin7in•7h ago•69 comments

Scaling long-running autonomous coding

https://cursor.com/blog/scaling-agents
223•samwillis•14h ago•135 comments

New Safari developer tools provide insight into CSS Grid Lanes

https://webkit.org/blog/17746/new-safari-developer-tools-provide-insight-into-css-grid-lanes/
82•feross•12h ago•38 comments

Impeccable Style

https://impeccable.style
3•noemit•3d ago•0 comments

Ask HN: What did you find out or explore today?

126•blahaj•19h ago•207 comments

Bubblewrap: A nimble way to prevent agents from accessing your .env files

https://patrickmccanna.net/a-better-way-to-limit-claude-code-and-other-coding-agents-access-to-se...
119•0o_MrPatrick_o0•11h ago•92 comments

Python: Tprof, a Targeting Profiler

https://adamj.eu/tech/2026/01/14/python-introducing-tprof/
14•jonatron•4h ago•0 comments

The State of OpenSSL for pyca/cryptography

https://cryptography.io/en/latest/statements/state-of-openssl/
155•SGran•15h ago•29 comments

Furiosa: 3.5x efficiency over H100s

https://furiosa.ai/blog/introducing-rngd-server-efficient-ai-inference-at-data-center-scale
186•written-beyond•12h ago•126 comments

Crafting Interpreters

https://craftinginterpreters.com/
145•tosh•14h ago•22 comments

Show HN: Sparrow-1 – Audio-native model for human-level turn-taking without ASR

https://www.tavus.io/post/sparrow-1-human-level-conversational-timing-in-real-time-voice
83•code_brian•19h ago•18 comments

Project SkyWatch (a.k.a. Wescam at Home)

https://ianservin.com/2026/01/13/project-skywatch-aka-wescam-at-home/
66•jjwiseman•20h ago•13 comments

Bare metal programming with RISC-V guide (2023)

https://popovicu.com/posts/bare-metal-programming-risc-v/
38•todsacerdoti•5d ago•8 comments

Find a pub that needs you

https://www.ismypubfucked.com/
325•thinkingemote•21h ago•288 comments

Show HN: WebTiles – create a tiny 250x250 website with neighbors around you

https://webtiles.kicya.net/
200•dimden•5d ago•32 comments