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

VoIP brings back old-fashioned pay phones to rural Vermont (2025)

https://spectrum.ieee.org/payphone-voip
90•bookofjoe•3h ago•16 comments

Prolog Coding Horror

https://www.metalevel.at/prolog/horror
28•RohanAdwankar•1h ago•4 comments

Mercurial, 20 years and counting: how are we still alive and kicking? [video]

https://fosdem.org/2026/schedule/event/AGWUVH-mercurial-aint-you-dead-yet/
130•ibobev•2d ago•104 comments

I turned a $80 RK3562 Android tablet into a Debian Linux workstation

https://github.com/tech4bot/rk3562deb
210•tech4bot•9h ago•112 comments

Magical Realism: “Northern Exposure” 25 Years Later (2015)

https://www.rogerebert.com/streaming/magical-realism-nothern-exposure-25-years-later
47•walterbell•1d ago•18 comments

Multi-Species Canopy Latrines in Costa Rican Cloud Forests

https://onlinelibrary.wiley.com/doi/10.1002/ece3.72964
34•PaulHoule•3d ago•2 comments

Show HN: Semble – Code search for agents that uses 98% fewer tokens than grep

https://github.com/MinishLab/semble
90•Bibabomas•7h ago•33 comments

Hindenburg’s Smoking Room

https://www.airships.net/hindenburg-smoking-room/
137•crescit_eundo•3d ago•77 comments

GenCAD

https://gencad.github.io/
4•dagenix•1h ago•0 comments

New Nightmare Just Dropped: '3D' Animated Ads on Trucks in Traffic

https://www.thedrive.com/news/new-nightmare-just-dropped-3d-animated-ads-on-trucks-in-traffic
43•cf100clunk•1d ago•17 comments

I don't think AI will make your processes go faster

https://frederickvanbrabant.com/blog/2026-05-15-i-dont-think-ai-will-make-your-processes-go-faster/
453•TheEdonian•10h ago•326 comments

CUDA Books

https://github.com/alternbits/awesome-cuda-books
104•dariubs•9h ago•21 comments

High-Entropy Alloy

https://en.wikipedia.org/wiki/High-entropy_alloy
93•leonidasrup•3d ago•20 comments

Zerostack – A Unix-inspired coding agent written in pure Rust

https://crates.io/crates/zerostack/1.0.0
532•gidellav•1d ago•295 comments

Prolog Basics Explained with Pokémon

https://unplannedobsolescence.com/blog/prolog-basics-pokemon/
188•birdculture•2d ago•30 comments

Trials on veterans suggest ibogaine could provide a new treatment for PTSD

https://www.bbc.com/future/article/20260514-how-hallucinogenic-ibogaine-helps-veterans-overcome-ptsd
69•bushwart•10h ago•73 comments

The occasional ECONNRESET

https://movq.de/blog/postings/2026-05-05/1/POSTING-en.html
82•zdw•5h ago•19 comments

Schanuel's Conjecture and the Semantics of Triton's FPSan

https://cp4space.hatsya.com/2026/05/03/schanuels-conjecture-and-the-semantics-of-fpsan/
15•c1ccccc1•1d ago•3 comments

Native all the way, until you need text

https://justsitandgrin.im/posts/native-all-the-way-until-you-need-text/
362•dive•10h ago•240 comments

AI is a technology not a product

https://daringfireball.net/2026/05/ai_is_technology_not_a_product
279•ch_sm•9h ago•105 comments

Apple Silicon costs more than OpenRouter

https://www.williamangel.net/blog/2026/05/17/offline-llm-energy-use.html
284•datadrivenangel•10h ago•238 comments

Tesla Solar Roof is on life support as it pivot to panels

https://electrek.co/2026/05/14/tesla-solar-roof-promise-vs-reality-pivot-panels/
120•celsoazevedo•18h ago•128 comments

Mozilla to UK regulators: VPNs are essential privacy and security tools

https://blog.mozilla.org/netpolicy/2026/05/15/mozilla-to-uk-regulators-vpns-are-essential-privacy...
595•WithinReason•16h ago•258 comments

Colossus: The Forbin Project

https://en.wikipedia.org/wiki/Colossus:_The_Forbin_Project
204•doener•3d ago•77 comments

A nicer voltmeter clock

https://lcamtuf.substack.com/p/a-nicer-voltmeter-clock
302•surprisetalk•1d ago•38 comments

AI Wearables Are Coming but They'll Need to Pass the Coffee Shop Test to Survive

https://www.inc.com/connor-jewiss/ai-wearables-are-coming-but-theyll-need-to-pass-this-crucial-co...
6•connorjewiss•56m ago•0 comments

How diamonds are made

https://diamond.jaydip.me/
79•lemonberry•1d ago•51 comments

C++26 Shipped a SIMD Library Nobody Asked For

https://lucisqr.substack.com/p/c26-shipped-a-simd-library-nobody
181•signa11•2d ago•146 comments

OpenAI and Government of Malta partner to roll out ChatGPT Plus to all citizens

https://openai.com/index/malta-chatgpt-plus-partnership/
313•bookofjoe•1d ago•320 comments

Scientists “bottle the sun” with a liquid battery that stores solar energy

https://www.sciencedaily.com/releases/2026/05/260513221821.htm
40•ndr42•4h ago•29 comments