frontpage.
newsnewestaskshowjobs

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

Vite+ Beta

https://voidzero.dev/posts/announcing-vite-plus-beta
47•Erenay09•1h ago•20 comments

Android Developer Verification: Threat masquerading as Protection

https://f-droid.org/2026/07/01/adv-malware.html
903•drewfax•9h ago•382 comments

This blog is written in en-GB

https://shkspr.mobi/blog/2026/07/this-blog-is-written-in-en-gb/
75•mritzmann•37m ago•23 comments

Kimi K2.7 Code is generally available in GitHub Copilot

https://github.blog/changelog/2026-07-01-kimi-k2-7-is-now-available-in-github-copilot/
224•unliftedq•8h ago•102 comments

The Fall of the Theorem Economy

https://davidbessis.substack.com/p/the-fall-of-the-theorem-economy
102•varjag•4h ago•41 comments

ZCode – Harness for GLM-5.2

https://zcode.z.ai/en
440•chvid•14h ago•304 comments

Oomwoo, an open-source robot vacuum you build yourself

https://makerspet.com/blog/building-an-open-source-robot-vacuum-meet-oomwoo/
358•devicelimit•12h ago•67 comments

WinPE as a stateless harness for Windows driver testing and fuzzing

https://bednars.me/blog/winpe-harness
16•piotrbednarsalt•3d ago•0 comments

Ask HN: Who is quitting? (July 2026)

111•ethanwillis•56m ago•50 comments

Asymmetric Quantization: Near-Lossless Retrieval with 97% Storage Reduction

https://www.mixedbread.com/blog/asymmetric-quant
55•breadislove•2d ago•11 comments

Bring back crappy forums

https://tedium.co/2026/07/01/online-web-forums-retrospective/
356•pentagrama•10h ago•224 comments

What to learn to be a graphics programmer

https://blog.demofox.org/2026/07/01/what-to-learn-to-be-a-graphics-programmer/
376•atan2•19h ago•201 comments

FFmpeg 9.1's new AAC encoder

https://hydrogenaudio.org/index.php/topic,129691.0.html
399•ledoge•22h ago•128 comments

Why I'm Forced to Say Farewell: Google Management Has Lost Its Moral Compass

https://docs.google.com/document/d/1SH9QRTAlL02THgAN2AGmWe9El0_2ZJF6hhgDBx8k97c/edit?tab=t.0
77•vrganj•2h ago•40 comments

Creating a Personalised Bin Calendar

https://alexwlchan.net/2026/bin-calendar/
18•surprisetalk•2d ago•7 comments

Opening up 'Zero-Knowledge Proof' technology to promote privacy in age assurance

https://blog.google/innovation-and-ai/technology/safety-security/opening-up-zero-knowledge-proof-...
190•consumer451•14h ago•194 comments

Why jet engines aren't made in China

https://aakash.substack.com/p/why-jet-engines-arent-made-in-china
204•paulpauper•1d ago•192 comments

Ask HN: Who is hiring? (July 2026)

216•whoishiring•21h ago•223 comments

How do wombats poop cubes?

https://www.science.org/content/article/how-do-wombats-poop-cubes-scientists-get-bottom-mystery
145•bushwart•1d ago•82 comments

Google loses fight over record $4.7B EU antitrust fine

https://www.cnbc.com/2026/07/02/alphabet-google-android-eu-antitrust-fine-4-1-billion-euro-appeal...
158•boshomi•4h ago•143 comments

CursorBench 3.1

https://cursor.com/evals
93•handfuloflight•7h ago•57 comments

Weave Robotics launches Isaac 1, a $7,999 home robot with Fall 2026 deliveries

https://www.weaverobotics.com/isaac-1
205•ryanmerket•18h ago•290 comments

Using Aspect-Oriented Programming to Record DRL Agents' Data

https://blog.ptidej.net/using-aspect-oriented-programming-to-record-drl-agents-data/
3•luca-sctr•2d ago•1 comments

For first time, a cell built from scratch grows and divides

https://www.quantamagazine.org/for-the-first-time-a-cell-built-from-scratch-grows-and-divides-202...
874•defrost•22h ago•279 comments

My Favorite Keyboards

https://fabiensanglard.net/keyboards/index.html
74•tmach32•3d ago•56 comments

Monetization Gateway: Charge for any resource behind Cloudflare via x402

https://blog.cloudflare.com/monetization-gateway/
317•soheilpro•22h ago•216 comments

Qualcomm Linux 2.0

https://www.qualcomm.com/developer/blog/2026/06/qualcomm-linux-2-now-available
119•gilgamesh3•15h ago•55 comments

Senior SWE-Bench: open-source benchmark that assesses agents as senior engineers

https://senior-swe-bench.snorkel.ai/
109•matt_d•10h ago•83 comments

The Underhanded C Contest

https://underhanded-c.org/
107•ccabraldev•14h ago•12 comments

Learn Vim motions with an ice-cream van

https://thisismodest.com/vimscoops/
89•marcusmichaels•18h ago•30 comments