frontpage.
newsnewestaskshowjobs

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

Apple reveals new AI architecture built around Google Gemini models

https://www.macrumors.com/2026/06/08/apple-reveals-new-ai-architecture/
492•unclefuzzy•10h ago•382 comments

Old'aVista – The most powerful guide to the old Internet

https://oldavista.com/
54•abnercoimbre•14h ago•7 comments

Siri AI

https://www.apple.com/apple-intelligence/
512•0xedb•11h ago•442 comments

Show HN: Performative-UI – A react component library of design tropes

https://vorpus.github.io/performativeUI/
885•lizhang•16h ago•163 comments

xAI is looking more like a datacentre REIT than a frontier lab

https://martinalderson.com/posts/xais-new-rental-business/
497•martinald•14h ago•385 comments

MiMo-v2.5-Pro-UltraSpeed: 1T model with 1000 tokens per second

https://mimo.xiaomi.com/blog/mimo-tilert-1000tps
535•gainsurier•14h ago•387 comments

EU-banned pesticides found in rice, tea and spices

https://www.foodwatch.org/en/eu-banned-pesticides-found-in-rice-tea-and-spices
316•john-titor•14h ago•118 comments

Job: Head of Stonehenge

https://www.english-heritage.org.uk/about/our-people/careers-with-us/job-search/default-job-page/...
118•mooreds•2h ago•77 comments

Looking Forward to Postgres 19: Query Hints

https://www.pgedge.com/blog/looking-forward-to-postgres-19-query-hints
109•jjgreen•3d ago•16 comments

Passing DBs through continuations

https://remy.wang/blog/cps.html
33•remywang•2d ago•4 comments

GoGoGrandparent (YC S16) is hiring Back end Engineers

https://www.ycombinator.com/companies/gogograndparent/jobs/2vbzAw8-backend-engineer
1•davidchl•2h ago

Apple Core AI Framework

https://developer.apple.com/documentation/coreai/
248•hmokiguess•11h ago•61 comments

Show HN: Gitdot – a better GitHub. Open-source, written in Rust

https://gitdot.io/
207•baepaul•13h ago•167 comments

Porting the ThinkPad X61 to Coreboot

https://blog.aheymans.xyz/post/thinkpad_x61/
12•walterbell•2h ago•1 comments

How much do amd64 microarchitecture levels help in Go?

https://lemire.me/blog/2026/06/06/how-much-do-amd64-microarchitecture-levels-help-in-go/
32•zdw•1d ago•9 comments

Ask HN: What are tools you have made for yourself since the advent of AI?

229•aryamaan•11h ago•394 comments

Why are cells small?

https://burrito.bio/essays/what-limits-a-cells-size
129•mailyk•10h ago•60 comments

FrontierCode

https://cognition.ai/blog/frontier-code
141•streamer45•9h ago•28 comments

Surveillance is not safety: A statement on the UK's latest threat to privacy [pdf]

https://signal.org/blog/pdfs/2026-06-08-uk-surveillance-is-not-safety.pdf
499•g0xA52A2A•10h ago•184 comments

Ask HN: Why hasn't there been a real competitor to Ticketmaster yet?

124•mdni007•12h ago•108 comments

I'm building a parallel internet, and it's called The Thinnernet

https://inavoyage.blogspot.com/2026/06/im-building-parallel-internet-and-its.html
65•initramfs•10h ago•63 comments

CRDTs merge concurrent edits. Why not concurrent creation?

https://loro.dev/blog/mergeable-containers
3•czx111331•1h ago•0 comments

AI is slowing down

https://www.wheresyoured.at/ai-is-slowing-down/
482•crescit_eundo•14h ago•504 comments

Launch HN: Intuned (YC S22) – Build and run reliable browser automations as code

https://intunedhq.com
105•fkilaiwi•16h ago•45 comments

Apple bets cheaper AI will woo small developers

https://techcrunch.com/2026/06/08/apple-bets-cheaper-ai-will-woo-small-developers/
45•jbernardo95•9h ago•21 comments

Anti-social: It's fads, not friends, which now dominate social media feeds

https://www.bbc.com/worklife/article/20260520-how-social-media-ceased-to-be-social
609•1vuio0pswjnm7•18h ago•428 comments

Confidential submission of draft S-1 to the SEC

https://openai.com/index/openai-submits-confidential-s-1/
328•hackerBanana•8h ago•256 comments

OCaml Onboarding: Introduction to the Dune build system

https://ocamlpro.com/blog/2025_07_29_ocaml_onboarding_introduction_to_dune/
151•andrewstetsenko•4d ago•22 comments

Federal judge blocks H1B visa $100K fee

https://www.alaskasnewssource.com/2026/06/08/federal-judge-blocks-h1-b-visa-100k-fee/
131•naturalmovement•6h ago•245 comments

Games Between Programs: The Ruliology of Competition

https://writings.stephenwolfram.com/2026/06/games-between-programs-the-ruliology-of-competition/
22•andromaton•3d ago•1 comments