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

Comments

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

News publishers limit Internet Archive access due to AI scraping concerns

https://www.niemanlab.org/2026/01/news-publishers-limit-internet-archive-access-due-to-ai-scrapin...
289•ninjagoo•4h ago•175 comments

uBlock filter list to hide all YouTube Shorts

https://github.com/i5heu/ublock-hide-yt-shorts/
385•i5heu•5h ago•135 comments

My smart sleep mask broadcasts users' brainwaves to an open MQTT broker

https://aimilios.bearblog.dev/reverse-engineering-sleep-mask/
296•minimalthinker•7h ago•139 comments

Breaking the spell of vibe coding

https://www.fast.ai/posts/2026-01-28-dark-flow/
95•arjunbanker•1d ago•48 comments

Ooh.directory: a place to find good blogs that interest you

https://ooh.directory/
388•hisamafahri•9h ago•111 comments

Zvec: A lightweight, fast, in-process vector database

https://github.com/alibaba/zvec
20•dvrp•1d ago•2 comments

Flood Fill vs. The Magic Circle

https://www.robinsloan.com/winter-garden/magic-circle/
12•tobr•3d ago•1 comments

IBM tripling entry-level jobs after finding the limits of AI adoption

https://fortune.com/2026/02/13/tech-giant-ibm-tripling-gen-z-entry-level-hiring-according-to-chro...
122•WhatsTheBigIdea•23h ago•46 comments

Instagram's URL Blackhole

https://medium.com/@shredlife/instagrams-url-blackhole-c1733e081664
26•tkp-415•1d ago•5 comments

Discord: A case study in performance optimization

https://newsletter.fullstack.zip/p/discord-a-case-study-in-performance
33•tylerdane•22h ago•12 comments

Amsterdam Compiler Kit

https://github.com/davidgiven/ack
81•andsoitis•6h ago•16 comments

5,300-year-old 'bow drill' rewrites story of ancient Egyptian tools

https://www.ncl.ac.uk/press/articles/latest/2026/02/ancientegyptiandrillbit/
26•geox•3d ago•0 comments

Colored Petri Nets, LLMs, and distributed applications

https://blog.sao.dev/cpns-llms-distributed-apps/
14•stuartaxelowen•2h ago•0 comments

A header-only C vector database library

https://github.com/abdimoallim/vdb
47•abdimoalim•5h ago•12 comments

The consequences of task switching in supervisory programming

https://martinfowler.com/fragments/2026-02-13.html
19•bigwheels•1d ago•0 comments

Launching Interop 2026

https://hacks.mozilla.org/2026/02/launching-interop-2026/
26•linolevan•1d ago•2 comments

Ask HN: How to get started with robotics as a hobbyist?

132•StefanBatory•6d ago•57 comments

Descent, ported to the web

https://mrdoob.github.io/three-descent/
113•memalign•3h ago•19 comments

Show HN: Sameshi – a ~1200 Elo chess engine that fits within 2KB

https://github.com/datavorous/sameshi
171•datavorous_•9h ago•50 comments

Unicorn Jelly

https://unicornjelly.com/
20•avaer•10h ago•6 comments

A review of M Disc archival capability with long term testing results (2016)

http://www.microscopy-uk.org.uk/mag/artsep16/mol-mdisc-review.html
53•1970-01-01•7h ago•54 comments

How often do full-body MRIs find cancer?

https://www.usatoday.com/story/life/health-wellness/2026/02/11/full-body-mris-cancer-aneurysm/883...
56•brandonb•1d ago•43 comments

An AI agent published a hit piece on me – more things have happened

https://theshamblog.com/an-ai-agent-published-a-hit-piece-on-me-part-2/
591•scottshambaugh•22h ago•521 comments

OpenAI should build Slack

https://www.latent.space/p/ainews-why-openai-should-build-slack
78•swyx•15h ago•89 comments

Windows NT/OS2 Design Workbook

https://computernewb.com/~lily/files/Documents/NTDesignWorkbook/
58•markus_zhang•3d ago•22 comments

A method and calculator for building foamcore drawer organisers

https://capnfabs.net/posts/foamcore-would-be-a-sick-name-for-a-music-genre/
57•evakhoury•5d ago•13 comments

Vim 9.2

https://www.vim.org/vim-9.2-released.php
308•tapanjk•7h ago•132 comments

Fun with Algebraic Effects – From Toy Examples to Hardcaml Simulations

https://blog.janestreet.com/fun-with-algebraic-effects-hardcaml/
47•weinzierl•4d ago•1 comments

Zig – io_uring and Grand Central Dispatch std.Io implementations landed

https://ziglang.org/devlog/2026/#2026-02-13
337•Retro_Dev•14h ago•245 comments

Show HN: Arcmark – macOS bookmark manager that attaches to browser as sidebar

https://github.com/Geek-1001/arcmark
57•ahmed_sulajman•6h ago•13 comments