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

Darkbloom – Private inference on idle Macs

https://darkbloom.dev
48•twapi•1h ago•30 comments

The paper computer

https://jsomers.net/blog/the-paper-computer
81•jsomers•3d ago•13 comments

A Look into NaviDial, Japan's Legacy Phone Service

https://www.tokyodev.com/articles/a-look-into-navidial-japan-s-legacy-phone-service
12•pwim•49m ago•0 comments

Cybersecurity looks like proof of work now

https://www.dbreunig.com/2026/04/14/cybersecurity-is-proof-of-work-now.html
327•dbreunig•1d ago•114 comments

FSF trying to contact Google about spammer sending 10k+ mails from Gmail account

https://daedal.io/@thomzane/116410863009847575
15•pabs3•1h ago•1 comments

RedSun: System user access on Win 11/10 and Server with the April 2026 Update

https://github.com/Nightmare-Eclipse/RedSun
16•airhangerf15•1h ago•0 comments

ChatGPT for Excel

https://chatgpt.com/apps/spreadsheets/
150•armcat•7h ago•108 comments

I made a terminal pager

https://theleo.zone/posts/pager/
97•speckx•6h ago•20 comments

Introduction to spherical harmonics for graphics programmers

https://gpfault.net/posts/sph.html
55•luu•2d ago•6 comments

Cal.com is going closed source

https://cal.com/blog/cal-com-goes-closed-source-why
258•Benjamin_Dobell•13h ago•186 comments

God sleeps in the minerals

https://wchambliss.wordpress.com/2026/03/03/god-sleeps-in-the-minerals/
498•speckx•16h ago•99 comments

Google broke its promise to me – now ICE has my data

https://www.eff.org/deeplinks/2026/04/google-broke-its-promise-me-now-ice-has-my-data
1281•Brajeshwar•11h ago•552 comments

Stealth signals are bypassing Iran’s internet blackout

https://spectrum.ieee.org/iran-internet-blackout-satellite-tv
68•WaitWaitWha•2h ago•12 comments

Show HN: Hiraeth – AWS Emulator

https://github.com/SethPyle376/hiraeth
14•ozarkerD•2h ago•4 comments

The buns in McDonald's Japan's burger photos are all slightly askew

https://www.mcdonalds.co.jp/en/menu/burger/
317•bckygldstn•7h ago•165 comments

Retrofitting JIT Compilers into C Interpreters

https://tratt.net/laurie/blog/2026/retrofitting_jit_compilers_into_c_interpreters.html
63•ltratt•17h ago•14 comments

PiCore - Raspberry Pi Port of Tiny Core Linux

http://tinycorelinux.net/5.x/armv6/releases/README
94•gregsadetsky•9h ago•12 comments

Fast and Easy Levenshtein distance using a Trie

https://stevehanov.ca/blog/fast-and-easy-levenshtein-distance-using-a-trie
10•sebg•3d ago•0 comments

Live Nation illegally monopolized ticketing market, jury finds

https://www.bloomberg.com/news/articles/2026-04-15/live-nation-illegally-monopolized-ticketing-ma...
477•Alex_Bond•10h ago•140 comments

US v. Heppner (S.D.N.Y. 2026) no attorney-client privilege for AI chats [pdf]

https://fingfx.thomsonreuters.com/gfx/legaldocs/xmvjyjekkpr/Rakoff%20-%20order%20-%20AI.pdf
111•1vuio0pswjnm7•15h ago•86 comments

Anna's Archive loses $322M Spotify piracy case without a fight

https://torrentfreak.com/annas-archive-loses-322-million-spotify-piracy-case-without-a-fight/
378•askl•21h ago•393 comments

The Gemini app is now on Mac

https://blog.google/innovation-and-ai/products/gemini-app/gemini-app-now-on-mac-os/
118•thm•11h ago•56 comments

Intel Xpress Resurrection: Reviving a Forgotten EISA Beast

https://x86.fr/intel-xpress-resurrection-reviving-a-forgotten-eisa-beast/
38•ankitg12•3d ago•3 comments

YouTube users get option to set their Shorts time limit to zero minutes

https://www.theverge.com/streaming/912898/youtube-shorts-feed-limit-zero-minutes
256•pentagrama•5h ago•113 comments

Agent - Native Mac OS X coding ide/harness

https://github.com/macOS26/Agent
22•jv22222•4h ago•4 comments

CRISPR takes important step toward silencing Down syndrome’s extra chromosome

https://medicalxpress.com/news/2026-04-crispr-bold-silencing-syndrome-extra.html
105•amichail•12h ago•64 comments

Do you even need a database?

https://www.dbpro.app/blog/do-you-even-need-a-database
229•upmostly•16h ago•259 comments

Hacker News CLI (2014)

https://pythonhosted.org/hackernews-cli/commands.html
44•rolph•7h ago•20 comments

Adaptional (YC S25) is hiring AI engineers

https://www.ycombinator.com/companies/adaptional/jobs/k7W6ge9-founding-engineer
1•acesohc•12h ago

How can I keep from singing?

https://blog.danieljanus.pl/singing/
68•nathell•1d ago•21 comments