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

Comments

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

Moltbook

https://www.moltbook.com/
336•teej•5h ago•163 comments

OpenClaw – Moltbot Renamed Again

https://openclaw.ai/blog/introducing-openclaw
123•ed•3h ago•41 comments

How AI Impacts Skill Formation

https://arxiv.org/abs/2601.20245
59•northfield27•1h ago•27 comments

Grid: Free, local-first, browser-based 3D printing/CNC/laser slicer

https://grid.space/stem/
282•cyrusradfar•10h ago•97 comments

PlayStation 2 Recompilation Project Is Absolutely Incredible

https://redgamingtech.com/playstation-2-recompilation-project-is-absolutely-incredible/
419•croes•14h ago•194 comments

Software Pump and Dump

http://tautvilas.lt/software-pump-and-dump/
18•brisky•3d ago•3 comments

Project Genie: Experimenting with infinite, interactive worlds

https://blog.google/innovation-and-ai/models-and-research/google-deepmind/project-genie/
567•meetpateltech•16h ago•275 comments

Doin' It with a 555: One Chip to Rule Them All

https://aashvik.com/posts/555-revolution/
32•MonkeyClub•2d ago•17 comments

Claude Code daily benchmarks for degradation tracking

https://marginlab.ai/trackers/claude-code/
663•qwesr123•19h ago•308 comments

Photoroom (YC S20) Is Hiring a Head of Cross-Platform (Rust) in Paris

https://jobs.ashbyhq.com/photoroom/dc994a7c-e104-46e1-81c3-b88d635398b9
1•ea016•2h ago

Retiring GPT-4o, GPT-4.1, GPT-4.1 mini, and OpenAI o4-mini in ChatGPT

https://openai.com/index/retiring-gpt-4o-and-older-models/
185•rd•12h ago•253 comments

Stargaze: SpaceX's Space Situational Awareness System

https://starlink.com/updates/stargaze
79•hnburnsy•5h ago•20 comments

How AI assistance impacts the formation of coding skills

https://www.anthropic.com/research/AI-assistance-coding-skills
37•vismit2000•3h ago•5 comments

GOG: Linux "the next major frontier" for gaming as it works on a native client

https://www.xda-developers.com/gog-calls-linux-the-next-major-frontier-for-gaming-as-it-works-on-...
28•franczesko•54m ago•3 comments

AGENTS.md outperforms skills in our agent evals

https://vercel.com/blog/agents-md-outperforms-skills-in-our-agent-evals
326•maximedupre•19h ago•137 comments

Backseat Software

https://blog.mikeswanson.com/backseat-software/
92•zdw•10h ago•15 comments

The Dank Case for Scrolling Window Managers

https://tedium.co/2026/01/29/niri-danklinux-scrolling-window-managers/
73•todsacerdoti•4h ago•33 comments

The WiFi only works when it's raining (2024)

https://predr.ag/blog/wifi-only-works-when-its-raining/
178•epicalex•12h ago•54 comments

Nannou – A creative coding framework for Rust

https://github.com/nannou-org/nannou
27•dmit•2d ago•3 comments

Flameshot

https://github.com/flameshot-org/flameshot
186•OsrsNeedsf2P•13h ago•70 comments

Spacecurve: A space-filling curve playground

https://corte.si/posts/spacecurve/announce/
11•cortesi•2d ago•2 comments

Show HN: Mystral Native – Run JavaScript games natively with WebGPU (no browser)

https://github.com/mystralengine/mystralnative
25•Flux159•2d ago•3 comments

The paper model houses of Peter Fritz (2013)

https://socks-studio.com/2013/12/06/the-imaginary-town-of-an-unconscious-architect-the-387-paper-...
18•NaOH•2d ago•1 comments

My Mom and Dr. DeepSeek (2025)

https://restofworld.org/2025/ai-chatbot-china-sick/
181•kieto•14h ago•94 comments

Two days of oatmeal reduce cholesterol level

https://www.uni-bonn.de/en/news/017-2026
133•brandonb•6h ago•91 comments

CISA’s acting head uploaded sensitive files into public version of ChatGPT

https://www.politico.com/news/2026/01/27/cisa-madhu-gottumukkala-chatgpt-00749361
148•rurp•2d ago•218 comments

A lot of population numbers are fake

https://davidoks.blog/p/a-lot-of-population-numbers-are-fake
334•bookofjoe•19h ago•279 comments

Is the RAM shortage killing small VPS hosts?

https://www.fourplex.net/2026/01/29/is-the-ram-shortage-killing-small-vps-hosts/
171•neelc•17h ago•198 comments

Launch HN: AgentMail (YC S25) – An API that gives agents their own email inboxes

144•Haakam21•16h ago•148 comments

The Home Computer Hybrids: Atari, TI, and the FCC

https://technicshistory.com/2026/01/25/the-home-computer-hybrids/
21•cfmcdonald•3d ago•1 comments