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

Comments

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

Transparent Leadership Beats Servant Leadership

https://entropicthoughts.com/transparent-leadership-beats-servant-leadership
187•ibobev•4h ago•87 comments

It’s time to free JavaScript (2024)

https://javascript.tm/letter
531•pavelai•9h ago•267 comments

Multivox: Volumetric Display

https://github.com/AncientJames/multivox
26•jk_tech•1h ago•3 comments

Launch HN: Browser Buddy (YC W24) – A recommendation system for Internet writing

https://www.browserbuddy.com/
15•alien0006•1h ago•12 comments

I ignore the spotlight as a staff engineer

https://lalitm.com/software-engineering-outside-the-spotlight/
277•todsacerdoti•6h ago•120 comments

The End of the Train-Test Split

https://folio.benguzovsky.com/train-test
11•gmays•1h ago•1 comments

Functional Quadtrees

https://lbjgruppen.com/en/posts/functional-quadtree-clojure
77•lbj•4h ago•24 comments

Converge (YC S23) is hiring a martech expert in NYC

https://www.runconverge.com/careers/technical-customer-success-manager
1•janhenr•1h ago

A lost Amazon world just reappeared in Bolivia

https://www.sciencedaily.com/releases/2025/11/251130205421.htm
55•ashishgupta2209•3d ago•9 comments

Show HN: OnlyRecipe 2.0 – I added all features HN requested – 4 years later

https://onlyrecipeapp.com/?url=https://www.allrecipes.com/turkish-pasta-recipe-8754903
35•AwkwardPanda•3h ago•28 comments

Feynman vs. Computer

https://entropicthoughts.com/feynman-vs-computer
15•cgdl•2h ago•10 comments

PGlite – Embeddable Postgres

https://pglite.dev/
391•dsego•7h ago•92 comments

Autism should not be treated as a single condition

https://www.economist.com/science-and-technology/2025/12/03/why-autism-should-not-be-treated-as-a...
64•bookofjoe•1h ago•89 comments

Bootloader Unlock Wall of Shame

https://github.com/zenfyrdev/bootloader-unlock-wall-of-shame
53•thunderbong•2h ago•20 comments

What Is "Open Recursion"?

https://journal.stuffwithstuff.com/2013/08/26/what-is-open-recursion/
21•andsoitis•2d ago•2 comments

Uncloud - Tool for deploying containerised apps across servers without k8s

https://uncloud.run/
278•rgun•12h ago•124 comments

Show HN: MTXT – Music Text Format

https://github.com/Daninet/mtxt
71•daninet•4d ago•29 comments

Japanese Four-Cylinder Engine Is So Reliable Still in Production After 25 Years

https://www.topspeed.com/reliable-japanese-four-cylinder-engine-still-in-production/
110•teleforce•6h ago•88 comments

Show HN: Walrus – a Kafka alternative written in Rust

https://github.com/nubskr/walrus
108•janicerk•3d ago•35 comments

Proxmox Datacenter Manager 1.0 available

https://www.proxmox.com/en/about/company-details/press-releases/proxmox-datacenter-manager-1-0
50•speckx•2h ago•10 comments

Building optimistic UI in Rails (and learn custom elements)

https://railsdesigner.com/custom-elements/
62•amalinovic•7h ago•7 comments

Microsoft drops AI sales targets in half after salespeople miss their quotas

https://arstechnica.com/ai/2025/12/microsoft-slashes-ai-sales-growth-targets-as-customers-resist-...
139•OptionOfT•2h ago•112 comments

RAM is so expensive, Samsung won't even sell it to Samsung

https://www.pcworld.com/article/2998935/ram-is-so-expensive-samsung-wont-even-sell-it-to-samsung....
246•sethops1•4h ago•217 comments

Unreal Tournament 2004 is back

https://old.reddit.com/r/unrealtournament/comments/1pdbe69/breaking_unreal_tournament_2004_is_back/
347•keithoffer•8h ago•145 comments

Contextualization Machines

https://stochasm.blog/posts/contextualization-machines/
15•jxmorris12•3d ago•2 comments

Human hair grows through 'pulling' not pushing, study shows

https://phys.org/news/2025-12-human-hair.html
99•pseudolus•4h ago•36 comments

30 years ago today "Netscape and Sun announce JavaScript"

https://web.archive.org/web/20070916144913/http://wp.netscape.com/newsref/pr/newsrelease67.html
155•donohoe•6h ago•63 comments

Average DRAM price in USD over last 18 months

https://pcpartpicker.com/trends/price/memory/
460•zekrioca•18h ago•335 comments

1D Conway's Life glider found, 3.7B cells long

https://conwaylife.com/forums/viewtopic.php?&p=222136#p222136
499•nooks•1d ago•190 comments

All the Way Down

https://www.futilitycloset.com/2025/11/17/all-the-way-down-2/
76•surprisetalk•5d ago•30 comments