frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

The Scalar Select Anti-Pattern

https://matklad.github.io/2025/05/14/scalar-select-aniti-pattern.html
38•goranmoomin•1d ago

Comments

castratikron•7h 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•1h 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•6h 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•3h 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•2h 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•6h ago
in CPU's - pipelining!
jchw•3h 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...)

Baby is healed with first personalized gene-editing treatment

https://www.nytimes.com/2025/05/15/health/gene-editing-personalized-rare-disorders.html
632•jbredeche•9h ago•280 comments

Cracked - method chaining/CSS-style selector web audio library

https://github.com/billorcutt/i_dropped_my_phone_the_screen_cracked
18•stephenhandley•1h ago•3 comments

A leap year check in three instructions

https://hueffner.de/falk/blog/a-leap-year-check-in-three-instructions.html
208•gnabgib•6h ago•71 comments

Teal – A statically-typed dialect of Lua

https://teal-language.org/
64•generichuman•3h ago•42 comments

Ollama's new engine for multimodal models

https://ollama.com/blog/multimodal-models
32•LorenDB•2h ago•1 comments

Initialization in C++ is bonkers (2017)

https://blog.tartanllama.xyz/initialization-is-bonkers/
110•todsacerdoti•6h ago•80 comments

Sitting for a long time shrinks your brain even if you exercise

https://alz-journals.onlinelibrary.wiley.com/doi/full/10.1002/alz.70157
32•codexon•3h ago•12 comments

Tek – A music making program for 24-bit Unicode terminals

https://codeberg.org/unspeaker/tek
99•smartmic•8h ago•13 comments

Launch HN: Tinfoil (YC X25): Verifiable Privacy for Cloud AI

111•FrasiertheLion•11h ago•82 comments

The unreasonable effectiveness of an LLM agent loop with tool use

https://sketch.dev/blog/agent-loop
256•crawshaw•8h ago•162 comments

NASA keeps ancient Voyager 1 spacecraft alive with Hail Mary thruster fix

https://www.theregister.com/2025/05/15/voyager_1_survives_with_thruster_fix/
146•nullhole•3h ago•20 comments

I was a Theranos whistleblower. Here's what I think Elizabeth Holmes is up to

https://www.statnews.com/2025/05/15/theranos-whistleblower-tyler-shultz-commentary-elizabeth-holmes-billy-evans-haemanthus-startup/
68•iancmceachern•2h ago•28 comments

Rolling Highway

https://en.wikipedia.org/wiki/Rolling_highway
22•taubek•2d ago•11 comments

The current state of TLA⁺ development

https://ahelwer.ca/post/2025-05-15-tla-dev-status/
99•todsacerdoti•9h ago•23 comments

Lock-Free Rust: How to Build a Rollercoaster While It's on Fire

https://yeet.cx/blog/lock-free-rust/
23•r3tr0•2d ago•4 comments

A Tiny Boltzmann Machine

https://eoinmurray.info/boltzmann-machine
225•anomancer•14h ago•39 comments

GTK Krell Monitors

https://gkrellm.srcbox.net/
28•Deeg9rie9usi•2d ago•12 comments

Show HN: Easel – Code multiplayer games like singleplayer

https://easel.games/about
54•BSTRhino•1d ago•33 comments

Malicious compliance by booking an available meeting room

https://www.clientserver.dev/p/malicious-compliance-by-booking-an
315•jakevoytko•14h ago•294 comments

Dia – An Early Review

https://www.fldr.zip/blog/dia-review
4•wyxuan•2d ago•0 comments

Show HN: Min.js style compression of tech docs for LLM context

https://github.com/marv1nnnnn/llm-min.txt
158•marv1nnnnn•14h ago•46 comments

"The Mind in the Wheel" lays out a new foundation for the science of mind

https://www.experimental-history.com/p/new-paradigm-for-psychology-just
55•CharlesW•9h ago•53 comments

Improving Naval Ship Acquisition

https://www.construction-physics.com/p/fixing-naval-ship-acquisition
45•Luc•9h ago•76 comments

In the US, a rotating detonation rocket engine takes flight

https://arstechnica.com/space/2025/05/venus-aerospace-flies-its-rotating-detonation-rocket-engine-for-the-first-time/
78•LorenDB•16h ago•61 comments

Fetii (YC S22) Is Hiring

https://www.ycombinator.com/companies/fetii/jobs/QDjleWs-senior-operations-manager-fetii
1•Mattiommi•11h ago

I don't like NumPy

https://dynomight.net/numpy/
374•MinimalAction•11h ago•161 comments

Dr. Dobb's Journal interviews Jef Raskin (1986)

https://computeradsfromthepast.substack.com/p/dr-dobbs-journal-interviews-jef-raskin
67•rbanffy•9h ago•52 comments

Refactoring Clojure

https://www.orsolabs.com/post/refactoring-clojure-1/
82•luu•8h ago•20 comments

Coinbase says hackers bribed staff to steal customer data, demanding $20M ransom

https://www.cnbc.com/2025/05/15/coinbase-says-hackers-bribed-staff-to-steal-customer-data-and-are-demanding-20-million-ransom.html
313•gpi•12h ago•344 comments

Pathfinding

https://juhrjuhr.itch.io/deep-space-exploitation/devlog/945428/9-pathfinding
122•sebg•15h ago•40 comments