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

Comments

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

SHARP, an approach to photorealistic view synthesis from a single image

https://apple.github.io/ml-sharp/
294•dvrp•5h ago•59 comments

Children with cancer scammed out of millions fundraised for their treatment

https://www.bbc.com/news/articles/ckgz318y8elo
197•1659447091•3h ago•139 comments

The biggest heat pumps in the world

https://www.bbc.com/news/articles/c17p44w87rno
35•rayhaanj•1h ago•21 comments

A linear-time alternative for Dimensionality Reduction and fast visualisation

https://medium.com/@roman.f/a-linear-time-alternative-to-t-sne-for-dimensionality-reduction-and-f...
55•romanfll•3h ago•14 comments

Quill OS: An open-source OS for Kobo's eReaders

https://quill-os.org/
269•Curiositry•9h ago•87 comments

Bonsai: A Voxel Engine, from scratch

https://github.com/scallyw4g/bonsai
47•jesse__•3h ago•6 comments

Erdős Problem #1026

https://terrytao.wordpress.com/2025/12/08/the-story-of-erdos-problem-126/
84•tzury•5h ago•7 comments

15,000 Free Pixel Art Icons

https://piixes.com/
7•Sayuj01•1h ago•5 comments

O'saasy License Agreement

https://osaasy.dev/
38•d3w1tt•3h ago•36 comments

JetBlue flight averts mid-air collision with US Air Force jet

https://www.reuters.com/world/americas/jetblue-flight-averts-mid-air-collision-with-us-air-force-...
266•divbzero•11h ago•152 comments

Creating C closures from Lua closures

https://lowkpro.com/blog/creating-c-closures-from-lua-closures.html
30•publicdebates•4d ago•2 comments

Internal RFCs saved us months of wasted work

https://highimpactengineering.substack.com/p/the-illusion-of-shared-understanding
18•romannikolaev•5d ago•6 comments

8M users' AI conversations sold for profit by "privacy" extensions

https://www.koi.ai/blog/urban-vpn-browser-extension-ai-conversations-data-collection
476•takira•6h ago•151 comments

“Are you the one?” is free money

https://blog.owenlacey.dev/posts/are-you-the-one-is-free-money/
333•samwho•4d ago•65 comments

Native vs. emulation: World of Warcraft game performance on Snapdragon X Elite

https://rkblog.dev/posts/pc-hardware/pc-on-arm/x86_versus_arm_native_game/
76•geekman7473•10h ago•30 comments

7 Years, 2 Rebuilds, 40K+ Stars: Milvus Recap and Roadmap

https://milvus.io/blog/milvus-exceeds-40k-github-stars.md
17•Fendy•5d ago•4 comments

Economics of Orbital vs. Terrestrial Data Centers

https://andrewmccalip.com/space-datacenters
114•flinner•12h ago•165 comments

Show HN: I designed my own 3D printer motherboard

https://github.com/KaiPereira/Cheetah-MX4-Mini
63•kaipereira•1w ago•14 comments

Rollstack (YC W23) is hiring multiple software engineers (TypeScript) US/Canada

https://www.ycombinator.com/companies/rollstack-2/jobs/QPqpb1n-software-engineer-typescript-us-ca...
1•yjallouli•8h ago

I'm a Tech Lead, and nobody listens to me. What should I do?

https://world.hey.com/joaoqalves/i-m-a-tech-lead-and-nobody-listens-to-me-what-should-i-do-e16e454d
8•joaoqalves•22m ago•0 comments

Mark V Shaney

https://en.wikipedia.org/wiki/Mark_V._Shaney
10•djoldman•4d ago•1 comments

Essential Semiconductor Physics [pdf]

https://nanohub.org/resources/43623/download/Essential_Semiconductor_Physics.pdf
186•akshatjiwan•2d ago•7 comments

Chafa: Terminal Graphics for the 21st Century

https://hpjansson.org/chafa/
161•birdculture•15h ago•24 comments

Umbrel – Personal Cloud

https://umbrel.com
187•oldfuture•14h ago•100 comments

Light intensity steers molecular assemblies into 1D, 2D or 3D structures

https://phys.org/news/2025-11-intensity-molecular-1d-2d-3d.html
25•PaulHoule•5d ago•3 comments

In Defense of Matlab Code

https://runmat.org/blog/in-defense-of-matlab-whiteboard-style-code
120•finbarr1987•3d ago•128 comments

Secret Documents Show Pepsi and Walmart Colluded to Raise Food Prices

https://www.thebignewsletter.com/p/secret-documents-show-pepsi-and-walmart
418•connor11528•12h ago•101 comments

The appropriate amount of effort is zero

https://expandingawareness.org/blog/the-appropriate-amount-of-effort-is-zero/
123•gmays•13h ago•72 comments

Understanding carriage

https://seths.blog/2025/12/understanding-carriage/
50•herbertl•5d ago•12 comments

A kernel bug froze my machine: Debugging an async-profiler deadlock

https://questdb.com/blog/async-profiler-kernel-bug/
95•bluestreak•13h ago•17 comments