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

GPTZero finds 100 new hallucinations in NeurIPS 2025 accepted papers

https://gptzero.me/news/neurips/
445•segmenta•4h ago•242 comments

Show HN: isometric.nyc – giant isometric pixel art map of NYC

https://cannoneyed.com/isometric-nyc/
186•cannoneyed•2h ago•59 comments

I was banned from Claude for scaffolding a Claude.md file

https://hugodaniel.com/posts/claude-code-banned-me/
36•hugodan•45m ago•14 comments

It looks like the status/need-triage label was removed

https://github.com/google-gemini/gemini-cli/issues/16728
167•nickswalker•3h ago•48 comments

Qwen3-TTS Family Is Now Open Sourced: Voice Design, Clone, and Generation

https://qwen.ai/blog?id=qwen3tts-0115
270•Palmik•5h ago•77 comments

CSS Optical Illusions

https://alvaromontoro.com/blog/68091/css-optical-illusions
53•ulrischa•1h ago•5 comments

Tree-sitter vs. Language Servers

https://lambdaland.org/posts/2026-01-21_tree-sitter_vs_lsp/
147•ashton314•4h ago•42 comments

Mote: An Interactive Ecosystem Simulation [video]

https://www.youtube.com/watch?v=Hju0H3NHxVI
28•evakhoury•20h ago•1 comments

Design Thinking Books You Must Read

https://www.designorate.com/design-thinking-books/
228•rrm1977•7h ago•107 comments

Launch HN: Constellation Space (YC W26) – AI for satellite mission assurance

https://constellation-io.com/
17•kmajid•2h ago•1 comments

AnswerThis (YC F25) Is Hiring

https://www.ycombinator.com/companies/answerthis/jobs/r5VHmSC-ai-agent-orchestration
1•ayush4921•2h ago

In Europe, Wind and Solar Overtake Fossil Fuels

https://e360.yale.edu/digest/europe-wind-solar-fossil-fuels
365•speckx•5h ago•366 comments

Recent discoveries on the acquisition of the highest levels of human performance

https://www.science.org/doi/abs/10.1126/science.adt7790
10•colincooke•1h ago•0 comments

Show HN: BrowserOS – "Claude Cowork" in the browser

https://github.com/browseros-ai/BrowserOS
10•felarof•2h ago•2 comments

Keeping 20k GPUs Healthy

https://modal.com/blog/gpu-health
7•jxmorris12•4d ago•0 comments

ISO PDF spec is getting Brotli – ~20 % smaller documents with no quality loss

https://pdfa.org/want-to-make-your-pdfs-20-smaller-for-free/
114•whizzx•8h ago•66 comments

30 Years of ReactOS

https://reactos.org/blogs/30yrs-of-ros/
203•Mark_Jansen•11h ago•102 comments

TTY and Buffering

https://mattrighetti.com/2026/01/12/tty-and-buffering
17•mattrighetti•5d ago•2 comments

Show HN: Sweep, Open-weights 1.5B model for next-edit autocomplete

https://huggingface.co/sweepai/sweep-next-edit-1.5B
490•williamzeng0•20h ago•102 comments

Your brain on ChatGPT: Accumulation of cognitive debt when using an AI assistant

https://www.media.mit.edu/publications/your-brain-on-chatgpt/
553•misswaterfairy•20h ago•401 comments

Doctors in Brazil using tilapia fish skin to treat burn victims

https://www.pbs.org/newshour/health/brazilian-city-uses-tilapia-fish-skin-treat-burn-victims
246•kaycebasques•14h ago•74 comments

Joe Armstrong and Jeremy Ruston – Intertwingling the Tiddlywiki with Erlang [video]

https://www.youtube.com/watch?v=Uv1UfLPK7_Q
34•kerim-ca•2d ago•2 comments

Show HN: Interactive physics simulations I built while teaching my daughter

https://www.projectlumen.app/
54•anticlickwise•3d ago•12 comments

Macron says €300B in EU savings sent to the US every year will be invested in EU

https://old.reddit.com/r/europe/comments/1qjtvtl/macron_says_300_billion_in_european_savings_flown/
123•consumer451•1h ago•113 comments

We will ban you and ridicule you in public if you waste our time on crap reports

https://curl.se/.well-known/security.txt
832•latexr•8h ago•519 comments

In Praise of APL (1977)

https://www.jsoftware.com/papers/perlis77.htm
82•tosh•10h ago•48 comments

Show HN: Synesthesia, make noise music with a colorpicker

https://visualnoise.ca
3•tevans3•13h ago•1 comments

eBay explicitly bans AI "buy for me" agents in user agreement update

https://www.valueaddedresource.net/ebay-bans-ai-agents-updates-arbitration-user-agreement-feb-2026/
287•bdcravens•22h ago•304 comments

Threat actors expand abuse of Microsoft Visual Studio Code

https://www.jamf.com/blog/threat-actors-expand-abuse-of-visual-studio-code/
262•vinnyglennon•19h ago•263 comments

The mushroom making people hallucinate tiny humans

https://www.bbc.com/future/article/20260121-the-mysterious-mushroom-that-makes-you-see-tiny-people
69•1659447091•8h ago•33 comments