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

Comments

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

US banks' exposure to private credit hits $300B (2025)

https://alternativecreditinvestor.com/2025/10/22/us-banks-exposure-to-private-credit-hits-300bn/
60•JumpCrisscross•1h ago•25 comments

Show HN: We analyzed 1,573 Claude Code sessions to see how AI agents work

https://github.com/obsessiondb/rudel
36•keks0r•1h ago•22 comments

Dolphin Progress Release 2603

https://dolphin-emu.org/blog/2026/03/12/dolphin-progress-report-release-2603/
158•BitPirate•5h ago•18 comments

Show HN: Axe A 12MB binary that replaces your AI framework

https://github.com/jrswab/axe
19•jrswab•53m ago•5 comments

Iranian Hacktivists Strike Medical Device Maker Stryker and Wiped Systems

https://www.zetter-zeroday.com/iranian-hacktivists-strike-medical-device-maker-stryker-in-severe-...
37•strict9•47m ago•36 comments

Hive (YC S14) is hiring scrappy product managers and product/data engineers

https://jobs.ashbyhq.com/hive.co
1•patman_h•9m ago

Big Data on the Cheapest MacBook

https://duckdb.org/2026/03/11/big-data-on-the-cheapest-macbook
178•bcye•3h ago•145 comments

Avoiding Trigonometry (2013)

https://iquilezles.org/articles/noacos/
120•WithinReason•5h ago•24 comments

3D-Knitting: The Ultimate Guide

https://www.oliver-charles.com/pages/3d-knitting
151•ChadNauseam•6h ago•55 comments

Malus – Clean Room as a Service

https://malus.sh
13•microflash•1h ago•4 comments

The purpose of Continuous Integration is to fail

https://blog.nix-ci.com/post/2026-02-05_the-purpose-of-ci-is-to-fail
11•Norfair•2d ago•6 comments

Show HN: s@: decentralized social networking over static sites

http://satproto.org/
357•remywang•14h ago•160 comments

SBCL: A Sanely-Bootstrappable Common Lisp (2008) [pdf]

https://research.gold.ac.uk/id/eprint/2336/1/sbcl.pdf
84•pabs3•7h ago•46 comments

Show HN: Calyx – Ghostty-Based macOS Terminal with Liquid Glass UI

https://github.com/yuuichieguchi/Calyx
8•yuu1ch13•1h ago•18 comments

Printf-Tac-Toe

https://github.com/carlini/printf-tac-toe
71•carlos-menezes•4d ago•6 comments

Returning to Rails in 2026

https://www.markround.com/blog/2026/03/05/returning-to-rails-in-2026/
245•stanislavb•8h ago•154 comments

High fidelity font synthesis for CJK languages

https://github.com/kaonashi-tyc/zi2zi-JiT
19•kaonashi-tyc-01•3d ago•2 comments

ArcaOS 5.1.2 (based on OS/2 Warp 4.52) now available

https://www.arcanoae.com/arcaos-5-1-2-now-available/
19•speckx•1h ago•7 comments

Emacs internals: Tagged pointers vs. C++ std:variant and LLVM (Part 3)

https://thecloudlet.github.io/blog/project/emacs-03/
9•thecloudlet•2h ago•2 comments

Datahäxan

https://0dd.company/galleries/witches/7.html
102•akkartik•2d ago•8 comments

I was interviewed by an AI bot for a job

https://www.theverge.com/featured-video/892850/i-was-interviewed-by-an-ai-bot-for-a-job
375•speckx•20h ago•376 comments

Tested: How Many Times Can a DVD±RW Be Rewritten? Methodology and Results

https://goughlui.com/2026/03/07/tested-how-many-times-can-a-dvd%C2%B1rw-be-rewritten-part-2-metho...
197•giuliomagnifico•4d ago•65 comments

1B identity records exposed in ID verification data leak

https://www.aol.com/articles/1-billion-identity-records-exposed-152505381.html
141•robtherobber•4h ago•33 comments

Don't post generated/AI-edited comments. HN is for conversation between humans

https://news.ycombinator.com/newsguidelines.html#generated
3871•usefulposter•19h ago•1446 comments

WebPKI and You

https://blog.brycekerley.net/2026/03/08/webpki-and-you.html
75•aragilar•3d ago•9 comments

NASA's DART spacecraft changed an asteroid's orbit around the sun

https://www.sciencenews.org/article/spacecraft-changed-asteroid-orbit-nasa
60•pseudolus•3d ago•33 comments

USDA is closing buildings, relocating staff, and downsizing-a lot

https://www.foodpolitics.com/2026/03/usda-is-closing-buildings-relocating-staff-and-downsizing-a-...
18•speckx•57m ago•4 comments

Show HN: I built a tool that watches webpages and exposes changes as RSS

https://sitespy.app
289•vkuprin•22h ago•75 comments

Reliable Software in the LLM Era

https://quint-lang.org/posts/llm_era
38•mempirate•6h ago•19 comments

Faster asin() was hiding in plain sight

https://16bpp.net/blog/post/faster-asin-was-hiding-in-plain-sight/
230•def-pri-pub•1d ago•122 comments