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

Meta enables ADB on deprecated Portal devices [video]

https://fb.watch/HxPu0fSyeH/
116•jenders•3h ago•25 comments

Anthropic's open-source framework for AI-powered vulnerability discovery

https://github.com/anthropics/defending-code-reference-harness
311•binyu•7h ago•98 comments

Do transformers need three projections? Systematic study of QKV variants

https://arxiv.org/abs/2606.04032
120•Anon84•4h ago•20 comments

Open Code Review – An AI-powered code review CLI tool

https://github.com/alibaba/open-code-review
81•geoffbp•3h ago•19 comments

VoidZero Is Joining Cloudflare

https://blog.cloudflare.com/voidzero-joins-cloudflare/
590•coloneltcb•14h ago•262 comments

When AI Builds Itself: Our progress toward recursive self-improvement

https://www.anthropic.com/institute/recursive-self-improvement
374•meetpateltech•11h ago•488 comments

I'm skeptical about efforts to revolutionize schooling

https://www.scotthyoung.com/blog/2026/05/27/revolutionize-schooling/
93•andrewstuart•2d ago•159 comments

Branchless Quicksort faster than std:sort and pdqsort with C and C++ API

https://tiki.li/blog/blqsort
113•birdculture•2d ago•18 comments

Reverse-Engineered Userspace Driver for Asus ZenVision Lid OLED on Linux"

https://github.com/tarpediem/zenvision-linux
33•berlianta•2d ago•3 comments

Ian's Secure Shoelace Knot

https://www.fieggen.com/shoelace/secureknot.htm
530•mooreds•16h ago•203 comments

Azure Linux 4.0 is Microsoft's first general-purpose Linux

https://www.boxofcables.dev/azure-linux-4-0-is-microsofts-first-general-purpose-linux/
3•haydenbarnes•40m ago•0 comments

South Korean Forums Will Need to Scan Every Images with AI Censorship Tools

https://discuss.privacyguides.net/t/south-korean-online-communities-will-need-to-scan-every-image...
38•Cider9986•4h ago•20 comments

CEO to staff: You're not getting a raise. We're spending on AI instead

https://www.businessinsider.com/teradata-pauses-raises-employee-compensation-ai-budget-2026-6
18•ValentineC•1h ago•2 comments

Queen bees emerge from special wax chambers

https://cen.acs.org/materials/biobased-materials/queen-bees-special-wax/104/web/2026/06
55•gmays•6h ago•8 comments

SpaceX, Other Mega IPOs Denied Fast Index Entry by S&P

https://www.bloomberg.com/news/articles/2026-06-04/s-p-dow-jones-keeps-megacap-ipo-rules-as-is-af...
193•tristanj•5h ago•89 comments

Samurai City

https://worksinprogress.co/issue/samurai-city/
120•zdw•2d ago•21 comments

KVarN: Native vLLM backend for KV-cache quantization by Huawei

https://github.com/huawei-csl/KVarN
119•theanonymousone•12h ago•12 comments

Go Experiments Explained

https://www.alexedwards.net/blog/go-experiments-explained
3•ingve•3d ago•0 comments

Retro-Tech Parenting

https://havenweb.org/2026/05/28/retro-tech.html
268•mawise•11h ago•181 comments

The Causes of Long Covid

https://www.science.org/content/blog-post/causes-long-covid
13•maxall4•50m ago•4 comments

I made a kernel 2.2x faster. It made my training loop 3x slower

https://kyrieblunders.bearblog.dev/making-dr-grpo-go-brrr/
8•vishal-padia•2d ago•0 comments

JLink JTAG Access on the Pinecil

https://danielmangum.com/posts/jlink-jtag-pinecil/
45•hasheddan•2d ago•8 comments

Castor: CERN Advanced STORage Manager

https://castor.web.cern.ch/content/home.html
45•naves•8h ago•20 comments

Show HN: Mercek – A Desktop IDE for AWS ECS

https://www.mercek.dev/
34•utibeumanah•6h ago•7 comments

Show HN: Uruky (EU-based Kagi alternative) now has Image Search and URL Rewrites

https://uruky.com/?il=en
217•BrunoBernardino•18h ago•197 comments

Making Debian or Fedora persistent live images

https://sigwait.org/~alex/blog/2026/05/28/smdBC8.html
67•henry_flower•3d ago•7 comments

Zettascale (YC S24) Is Hiring Founding FPGA Engineers

https://www.ycombinator.com/companies/zettascale/jobs/O9S1vqO-founding-engineer-fpga-rtl-asic-arc...
1•el_al•10h ago

Latent Agents: A Post-Training Procedure for Internalized Multi-Agent Debate

https://arxiv.org/abs/2604.24881
18•PaulHoule•4h ago•0 comments

Meta's ships facial recognition on smart glasses

https://www.buchodi.com/meta-glasses-facial-recognition/
253•buchodi•8h ago•213 comments

U.S. Army Corps of Engineers Bay Model

https://en.wikipedia.org/wiki/U.S._Army_Corps_of_Engineers_Bay_Model
223•tosh•2d ago•57 comments