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

ASCII characters are not pixels: a deep dive into ASCII rendering

https://alexharri.com/blog/ascii-rendering
246•alexharri•3h ago•33 comments

The Dilbert Afterlife

https://www.astralcodexten.com/p/the-dilbert-afterlife
138•rendall•1d ago•64 comments

ClickHouse acquires Langfuse

https://langfuse.com/blog/joining-clickhouse
124•tin7in•5h ago•41 comments

Map To Poster – Create Art of your favourite city

https://github.com/originalankur/maptoposter
84•originalankur•4h ago•30 comments

The 600-year-old origins of the word 'hello'

https://www.bbc.com/culture/article/20260113-hello-hiya-aloha-what-our-greetings-reveal
37•1659447091•3h ago•15 comments

US electricity demand surged in 2025 – solar handled 61% of it

https://electrek.co/2026/01/16/us-electricity-demand-surged-in-2025-solar-handled-61-percent/
149•doener•4h ago•112 comments

Sergei Fedorov's Escape from Soviet Union Helped Save Red Wings (2020)

https://www.freep.com/story/sports/nhl/red-wings/2026/01/12/sergei-fedorov-detroit-red-wings-russ...
12•rmason•4d ago•1 comments

Architecture for Disposable Systems

https://tuananh.net/2026/01/15/architecture-for-disposable-systems/
28•tuananh•3h ago•15 comments

East Germany balloon escape

https://en.wikipedia.org/wiki/East_Germany_balloon_escape
580•robertvc•21h ago•235 comments

Show HN: Streaming gigabyte medical images from S3 without downloading them

https://github.com/PABannier/WSIStreamer
74•el_pa_b•6h ago•12 comments

Cloudflare acquires Astro

https://astro.build/blog/joining-cloudflare/
867•todotask2•1d ago•367 comments

Italy investigates Activision Blizzard for pushing in-game purchases

https://techcrunch.com/2026/01/16/italy-investigates-activision-blizzard-for-pushing-in-game-purc...
17•7777777phil•1h ago•0 comments

The 'untouchable hacker god' behind Finland's biggest ever crime

https://www.theguardian.com/technology/2026/jan/17/vastaamo-hack-finland-therapy-notes
70•c420•7h ago•67 comments

The Risks of AI in Schools Outweigh the Benefits, Report Says

https://www.npr.org/2026/01/14/nx-s1-5674741/ai-schools-education
35•backpackerBMW•2h ago•12 comments

Lies, Damned Lies and Proofs: Formal Methods Are Not Slopless

https://www.lesswrong.com/posts/rhAPh3YzhPoBNpgHg/lies-damned-lies-and-proofs-formal-methods-are-...
62•OgsyedIE•3d ago•34 comments

Cursor's latest “browser experiment” implied success without evidence

https://embedding-shapes.github.io/cursor-implied-success-without-evidence/
617•embedding-shape•1d ago•267 comments

Fitdrop: Personal exploration of fashion from 1980 to 2025

https://fitdrop.cc/
16•num42•3h ago•4 comments

PCs refuse to shut down after Microsoft patch

https://www.theregister.com/2026/01/16/patch_tuesday_secure_launch_bug_no_shutdown/
84•smurda•4h ago•101 comments

High-Level Is the Goal

https://bvisness.me/high-level/
189•tobr•2d ago•82 comments

FLUX.2 [Klein]: Towards Interactive Visual Intelligence

https://bfl.ai/blog/flux2-klein-towards-interactive-visual-intelligence
177•GaggiX•15h ago•50 comments

6-Day and IP Address Certificates Are Generally Available

https://letsencrypt.org/2026/01/15/6day-and-ip-general-availability
436•jaas•23h ago•247 comments

After 25 years, Wikipedia has proved that news doesn't need to look like news

https://www.niemanlab.org/2026/01/after-25-years-wikipedia-has-proved-that-news-doesnt-need-to-lo...
125•giuliomagnifico•4h ago•117 comments

Show HN: Microwave – Native iOS app for videos on ATproto

https://testflight.apple.com/join/cVxV1W3g
27•sinned•3d ago•8 comments

LLM Structured Outputs Handbook

https://nanonets.com/cookbooks/structured-llm-outputs
302•vitaelabitur•1d ago•49 comments

Post-PARA: What survived 4 years of real use

https://cortwave.github.io/posts/post-para/
19•cortwave•5d ago•0 comments

Drone Hacking Part 1: Dumping Firmware and Bruteforcing ECC

https://neodyme.io/en/blog/drone_hacking_part_1/
101•tripdout•12h ago•16 comments

AV1 Image File Format Specification Gets an Upgrade with AVIF v1.2.0

https://aomedia.org/blog%20posts/AV1-Image-File-Format-Specification-Gets-an-Upgrade-with-AVIF/
38•breve•3h ago•0 comments

Releasing rainbow tables to accelerate Net-NTLMv1 protocol deprecation

https://cloud.google.com/blog/topics/threat-intelligence/net-ntlmv1-deprecation-rainbow-tables
133•linolevan•17h ago•78 comments

Ask HN: Is it still worth pursuing a software startup?

99•newbebee•12h ago•85 comments

Dell UltraSharp 52 Thunderbolt Hub Monitor

https://www.dell.com/en-us/shop/dell-ultrasharp-52-thunderbolt-hub-monitor-u5226kw/apd/210-bthw/m...
249•cebert•21h ago•312 comments