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

10th Gen Honda Civic Updates Are Signed with AOSP Test Keys

https://juniperspring.org/posts/honda-evil-valet/
145•librick•4h ago•21 comments

Noise infusion banned from statistical products published by Census Bureau

https://desfontain.es/blog/banning-noise.html
781•nl•15h ago•482 comments

GLM 5.2 Is Out

https://twitter.com/jietang/status/2065784751345287314
453•aloknnikhil•13h ago•248 comments

Every Frame Perfect

https://tonsky.me/blog/every-frame-perfect/
636•ravenical•17h ago•205 comments

Building a serial and VGA "everything console"

http://oldvcr.blogspot.com/2026/06/building-serial-and-vga-everything.html
13•classichasclass•2h ago•0 comments

Software Architecture Guide

https://martinfowler.com/architecture/
15•laxmena•1h ago•2 comments

Pac-Man, but You're the Ghost

https://garrit.xyz/posts/2026-06-13-pac-man-but-you-re-the-ghost
6•mindracer•1h ago•8 comments

FreeOberon – Open-Source, Cross-Platform, Free Pascal/Turbo Pascal-Like Language

https://github.com/kekcleader/FreeOberon
54•peter_d_sherman•2d ago•19 comments

Treating pancreatic tumours may have revealed cancer's master switch

https://economist.com/science-and-technology/2026/06/12/treating-pancreatic-tumours-may-have-reve...
330•andsoitis•15h ago•119 comments

Pyodide 314.0: Python packages can now publish WebAssembly wheels to PyPI

https://blog.pyodide.org/posts/314-release/
102•agriyakhetarpal•4d ago•26 comments

Python 3.14 garbage collection rigamarole

https://theconsensus.dev/p/2026/06/06/python-3-14-garbage-collection-rigamarole.html
26•eatonphil•1d ago•14 comments

Weave: Merging based on language structure and not lines

https://ataraxy-labs.github.io/weave/
12•rohanat•2h ago•2 comments

Apt Encounters of the Third Kind

https://igor-blue.github.io/2021/03/24/apt1.html
17•ogurechny•3h ago•3 comments

Codex for open source

https://openai.com/form/codex-for-oss/
203•EvgeniyZh•2d ago•68 comments

The Redistribution of Housing Wealth Caused by Rent Control [pdf]

https://www.rhawa.org/file/secure/shs-the-impact-of-rent-control-in-st-paul.pdf
59•luu•2h ago•81 comments

(Re//Verse 2026) Taxonomy and Deobfuscation of a Real World Binary Obfuscator [pdf]

https://github.com/AnalogCyberNuke/RE-Verse-2026-Slides/blob/main/Reverse26.pdf
4•not_a9•2d ago•1 comments

The Field Guide to CSS Grid Lanes

https://gridlanes.webkit.org/
15•ingve•3d ago•2 comments

GameBoy Workboy

https://tcrf.net/Workboy
173•tosh•11h ago•61 comments

Amazon CEO's talks with U.S. officials triggered crackdown on Anthropic models

https://www.wsj.com/tech/ai/amazon-ceos-talks-with-u-s-officials-triggered-crackdown-on-anthropic...
614•ls612•12h ago•451 comments

ReactOS (FOSS "Windows") achieves 3D-accelerated Half-Life on real hardware

https://www.phoronix.com/news/ReactOS-Running-Half-Life
145•jeditobe•5h ago•25 comments

Running DOS on Behringers DDX3216 with a DIY x86-Bios from Scratch

https://chrisdevblog.com/2026/06/08/running-dos-on-behringers-ddx3216-using-a-diy-x86-bios/
84•rasz•10h ago•20 comments

A low-carbon computing platform from your retired phones

https://research.google/blog/a-low-carbon-computing-platform-from-your-retired-phones/
263•vikas-sharma•19h ago•141 comments

Appreciating Exif

https://brentfitzgerald.com/posts/appreciating-exif/
144•burnto•4d ago•30 comments

Free SQL→ER diagram tool, runs in the browser, nothing uploaded

https://sqltoerdiagram.com/
5•robhati•1h ago•5 comments

Police officer investigated for using AI to 'create evidence' in multiple cases

https://news.sky.com/story/derbyshire-police-officer-investigated-for-using-ai-to-create-evidence...
274•austinallegro•9h ago•133 comments

Human Routers of Machine Words

https://borretti.me/article/human-routers-of-machine-words
51•zx321•7h ago•25 comments

RTX 5080 and RTX 3090 Setup: 80 Tok/s on Qwen 3.6 27B Q8

https://imil.net/blog/posts/2026/rtx-5080-+-rtx-3090-setup-80+-tok-s-on-qwen-3.6-27b-q8/
220•iMil•19h ago•74 comments

Ancient genome duplications laid the foundations of complex brains

https://www.ox.ac.uk/news/2026-06-09-ancient-genome-duplications-laid-the-foundations-of-complex-...
26•hhs•6h ago•1 comments

The adder at the heart of Intel's 8087 floating-point chip

https://www.righto.com/2026/06/intel-8087-adder-reverse-engineered.html
104•pwg•12h ago•26 comments

4 things to know about the new sunscreen ingredient the FDA approved

https://www.npr.org/2026/06/13/nx-s1-5856385/sunscreen-skin-protection-bemotrizinol
70•mikhael•4h ago•25 comments