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

Comments

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

Neural audio codecs: how to get audio into LLMs

https://kyutai.org/next/codec-explainer
220•karimf•4h ago•71 comments

Fallout from the AWS Outage: Smart Mattresses Go Rogue and Ruin Sleep Worldwide

https://quasa.io/media/the-strangest-fallout-from-the-aws-outage-smart-mattresses-go-rogue-and-ru...
78•jerlam•56m ago•78 comments

Foreign hackers breached a US nuclear weapons plant via SharePoint flaws

https://www.csoonline.com/article/4074962/foreign-hackers-breached-a-us-nuclear-weapons-plant-via...
42•zdw•1h ago•5 comments

The Greatness of Text Adventures

https://entropicthoughts.com/the-greatness-of-text-adventures
33•ibobev•1h ago•22 comments

ChatGPT Atlas

https://chatgpt.com/atlas
138•easton•29m ago•149 comments

LLMs Can Get "Brain Rot"

https://llm-brain-rot.github.io/
101•tamnd•3h ago•49 comments

Public trust demands open-source voting systems

https://www.voting.works/news/public-trust-demands-open-source-voting-systems
121•philips•1h ago•81 comments

Flexport Is Hiring SDRs in Chicago

https://job-boards.greenhouse.io/flexport/jobs/5690976?gh_jid=5690976
1•thedogeye•46m ago

StarGrid: A Brand-New Palm OS Strategy Game in 2025

https://quarters.captaintouch.com/blog/posts/2025-10-21-stargrid-has-arrived,-a-brand-new-palm-os...
153•capitain•6h ago•27 comments

The Programmer Identity Crisis

https://hojberg.xyz/the-programmer-identity-crisis/
15•imasl42•59m ago•16 comments

Our modular, high-performance Merkle Tree library for Rust

https://github.com/bilinearlabs/rs-merkle-tree
78•bibiver•4h ago•21 comments

Katakate: Dozens of VMs per node for safe code exec: K8s+Kata+Firecracker

https://github.com/Katakate/k7
28•gbxk•2h ago•9 comments

Ilo – a Forth system running on UEFI

https://asciinema.org/a/Lbxa2w9R5IbaJqW3INqVrbX8E
77•rickcarlino•4h ago•26 comments

AI Is Making Us Work More

https://tawandamunongo.dev/posts/2025/10/ai-work-more
137•elcapithanos•2h ago•146 comments

Apple alerts exploit developer that his iPhone was targeted with gov spyware

https://techcrunch.com/2025/10/21/apple-alerts-exploit-developer-that-his-iphone-was-targeted-wit...
93•speckx•1h ago•42 comments

Diamond Thermal Conductivity: A New Era in Chip Cooling

https://spectrum.ieee.org/diamond-thermal-conductivity
102•rbanffy•6h ago•29 comments

Ask HN: Our AWS account got compromised after their outage

60•kinj28•1h ago•10 comments

The Emulator's Gambit: Executing Code from Non-Executable Memory

https://redops.at/en/blog/the-emulators-gambit-executing-code-from-non-executable-memory
10•thewavelength•4d ago•2 comments

UA 1093

https://windbornesystems.com/blog/ua-1093
167•c420•3h ago•72 comments

AWS multiple services outage in us-east-1

https://health.aws.amazon.com/health/status?ts=20251020
2173•kondro•1d ago•1969 comments

Do not accept terms and conditions- the game

https://www.termsandconditions.game/
6•halflife•3d ago•3 comments

Language Support for Marginalia Search

https://www.marginalia.nu/log/a_126_multilingual/
149•Bogdanp•10h ago•12 comments

RF Shielding History: When the FCC Cracked Down on Computers

https://tedium.co/2025/10/20/computers-fcc-rf-interference-history/
28•shortformblog•3h ago•18 comments

Weekend projects: Chicken Squisher 3000

https://lcamtuf.substack.com/p/weekend-projects-chicken-squisher
46•robinhouston•1w ago•9 comments

KDE Connect: Enabling communication between all your devices

https://community.kde.org/KDEConnect
322•snthd•1w ago•137 comments

Quantum dynamics on your laptop? New technique moves us closer

https://www.buffalo.edu/news/releases/2025/10/quantum-dynamics-on-your-laptop.html
50•ceolin•1w ago•16 comments

Show HN: Clink – Bring your own CLI Agents, Ship instantly

https://clink.new
19•aaronSong•2h ago•20 comments

Pasta/80 is a simple Pascal cross compiler targeting the Z80 microprocessor

https://github.com/pleumann/pasta80
99•mariuz•10h ago•16 comments

Show HN: I'm making a detective game built on Wikipedia

https://detective.wiki/
270•jasonsmiles•4d ago•41 comments

Build Your Own Database

https://www.nan.fyi/database
5•nansdotio•1h ago•0 comments