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

SwiftUI After 7 Years: A Story of Mediocrity

https://ykvm.com/2026/07/swiftui-a-story-of-mediocrity/
39•mpweiher•49m ago•13 comments

Karpathy’s Pelican

https://twitter.com/karpathy/status/2083749667410727319
207•delichon•15h ago•169 comments

Show HN: Kakehashi – Experimental userspace to run macOS binaries on Linux ARM

https://github.com/wie-project/kakehashi
96•vlad_kalinkin•3h ago•26 comments

Developers are attached to tools because tools encode trust

https://stackoverflow.blog/2026/07/29/developers-are-attached-to-tools-because-tools-encode-trust/
65•HieronymusBosch•4d ago•25 comments

Show HN: NixOS-DGX-Spark – Nix and NixOS on the DGX Spark

https://github.com/graham33/nixos-dgx-spark
49•graham33•2h ago•13 comments

How the words we teach English language learners changed

https://pudding.cool/2026/07/essential-words/
149•c-oreills•4h ago•85 comments

Rooting, firmware analysis and persistent credentials of TP-Link TL-841N

https://blog.juni-mp4.com/posts/42/rooting-the-tplink-tl841n-pt1/
56•mindracer•3h ago•7 comments

Harvesting SSH Credentials: Insights from My Honeypot Network

https://uphillsecurity.com/articles/harvesting-ssh-credentials-insights-from-my-honeypot-network/
19•whatbackup•2h ago•11 comments

Twenty Years of RISC OS Open

https://www.riscosopen.org/news/articles/2026/06/20/twenty-years-of-risc-os-open
121•AlexeyBrin•7h ago•20 comments

F*: A general-purpose proof-oriented programming language

https://fstar-lang.org/
113•ducktective•7h ago•38 comments

Microsoft raises Xbox prices by up to 43%

https://www.theverge.com/games/974253/xbox-prices-increasing-200-euros
50•BlueBerry2001•56m ago•37 comments

Meshdiff – visually compare two STL versions in the browser, client-side

https://meshdiff.com/
149•projscope•8h ago•14 comments

When transit passes were designed by hand (2022)

https://letterformarchive.org/news/milwaukee-transit-passes/
61•nate•2d ago•18 comments

Fasttracker II clone in C using SDL 2

https://16-bits.org/ft2.php
87•andsoitis•4d ago•27 comments

Folding Paper Globes

https://foldingglobes.com/globes
112•dango2506•4d ago•23 comments

Note-Taking and Personal Knowledge Management

https://unattributed.cc/note-taking-and-personal-knowledge-management
6•surprisetalk•5d ago•0 comments

Show HN: Bor – Open-source policy management for Linux desktops

https://getbor.dev/blog/2026-08-02-bor-v080-release/
149•eniac111•10h ago•19 comments

Show HN: Fuse – statically typed functional programming language

https://fuselang.org
84•the_unproven•8h ago•17 comments

Turtle-inspired interactive Python project

https://www.codembark.com/projects/fv20lz9map/spider-web-drawing
10•camdenreslink•5d ago•1 comments

Artificial Intelligence: Ars Notoria and the Promise of Instant Knowledge

https://publicdomainreview.org/essay/ars-notoria/
109•jruohonen•9h ago•26 comments

Go 1.27 Interactive Tour

https://victoriametrics.com/blog/go-1-27/index.html
333•Hixon10•18h ago•165 comments

Great Question (YC W21) Is Hiring Senior Demand Gen Manager

https://www.ycombinator.com/companies/great-question/jobs/YutDxyf-senior-demand-generation-manager
1•nedwin•7h ago

Rust All Hands 2026 Retrospective

https://blog.rust-lang.org/inside-rust/2026/07/31/all-hands-2026-retrospective/
77•dcminter•9h ago•34 comments

Show HN: I'm a 15 Year Old Wannabe Engineer, This Is a Cycloidal Gearbox I Built

https://github.com/tom-ilan/cycloidal_gearbox
296•tomilan•17h ago•96 comments

Holocloth

https://holocloth.vercel.app
143•ingve•2d ago•26 comments

Diátaxis

https://diataxis.fr/
498•ryanseys•23h ago•56 comments

Norway Salmon

https://www.abc.net.au/news/2026-07-28/how-norway-s-salmon-industry-became-a-global-behemoth/1069...
105•CHB0403085482•5d ago•64 comments

MkLinux and the pimped-out Apple Workgroup Server 9150

http://oldvcr.blogspot.com/2026/08/mklinux-and-pimped-out-apple-workgroup.html
100•goldenskye•16h ago•14 comments

A Rant About “Technology” (2005)

https://www.ursulakleguin.com/a-rant-about-technology
126•jamesgill•4h ago•68 comments

ESP32-C3 SuperMini antenna modification

https://peterneufeld.wordpress.com/2025/03/04/esp32-c3-supermini-antenna-modification/
69•ta988•12h ago•11 comments