frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Why Object of Arrays beat interleaved arrays: a JavaScript performance issue

https://www.royalbhati.com/posts/js-array-vs-typedarray
20•howToTestFE•6d ago

Comments

jonny_eh•1h ago
> This test is a manufactured problem, a silly premise, false test cases and honestly dishonest if not ignorant

It’s amazing how vitriolicly wrong people can be. Before publicly criticizing someone in the above way, prove them wrong first. Don’t just assume they’re wrong.

cheevly•39m ago
But only llms hallucinate!
anematode•57m ago
> Sometimes even SIMD (eez nuts?)

I'm a bit rusty here, does V8 actually do auto-vectorization of JavaScript code these days?

adzm•35m ago
I don't think v8 does any auto-vectorization unless it's been added since 2024 which was the last time I checked.
anematode•10m ago
Thanks! That tracks; ~a year ago I tried fruitlessly to get some numerical stuff to vectorize in Node.js... gave up and switched to WASM SIMD.
saghm•33m ago
> Eliminating per-element object overhead — This is the biggest win (~5-6x)

I feel like this phrasing might be easy to misinterpret. Without carefully considering the context, it seems like it's implying that objects have higher overhead than arrays, and my intuition is that this is true, but I'd argue that there's a potentially more relevant way of looking at things.

In the "object of arrays" layout, you have one object and three arrays, but in the "array of objects" layout, you have one array and N objects, where N is the size of the array. Even if the overhead of objects was the same as can array, you'd be looking at more overhead as soon as you went past three elements. In fact, even if the overhead of an object was lower than the overhead of an array, you'd still reach more overhead with the "array of objects" layout if you have enough elements to make up for the difference. With a TypedArray (or an array of a single type that's optimized by the runtime in the way described fairly early on in the article), you're not looking at an extra level of indirection per element like you would with an object.

I'd be curious to see what the results would be if they repeated the "array of objects" benchmark with an "array of arrays", where each element is an array of size 3. I could imagine them being quite similar, but I'm also not sure if there's even more nuance that I'm falling to account for (e.g. maybe the runtime would recognize that an array of N/3 elements each being an array of 3 numbers could be "flattened" to an underlying representation of array of size N in memory and perform the same optimizations.

I think the meta lesson here may be that intuition about performance of arrays in JavaScript might be pretty tricky. At least in terms of external semantics, they're supposed to be roughly equivalent to objects with numbers as keys, but in practice there are probably enough optimizations being done (like the implicit recognition of an array of numbers as described in the article) that I suspect that intuition might be a bit naive in a lot of cases, and it's probably better to verify what's actually happening at runtime rather than trying to guess. (The meta meta lesson is that this is true for a lot of things in pretty much every language, and it's sometimes going to be necessary to verify your assumptions about what performance will be, but I think that's something easy to fail to do even when you're aware of it being an easy trap, so having some general things to look out for like arrays potentially not being intuitive can still be helpful).

mr_toad•9m ago
> I'd be curious to see what the results would be if they repeated the "array of objects" benchmark with an "array of arrays"

Arrays are objects, so I’d be surprised if it made much difference.

Erdos 281 solved with ChatGPT 5.2 Pro

https://twitter.com/neelsomani/status/2012695714187325745
105•nl•2h ago•40 comments

How scientists are using Claude to accelerate research and discovery

https://www.anthropic.com/news/accelerating-scientific-research
33•gmays•2h ago•22 comments

Lopado­temacho­selacho­galeo­kranio­leipsano­drim­hypo­trimmato­silphio­karab

https://en.wikipedia.org/wiki/Lopado%C2%ADtemacho%C2%ADselacho%C2%ADgaleo%C2%ADkranio%C2%ADleipsa...
46•firloop•2h ago•18 comments

No knives, only cook knives

https://kellykozakandjoshdonald.substack.com/p/no-knives-only-cook-knives
21•firloop•6h ago•0 comments

Profession by Isaac Asimov

https://www.abelard.org/asimov.php
25•bkudria•3h ago•2 comments

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

https://alexharri.com/blog/ascii-rendering
933•alexharri•18h ago•112 comments

Dark Mode vs. Light Mode: Which Is Better?

https://www.nngroup.com/articles/dark-mode/
19•seanwilson•4h ago•12 comments

jQuery 4.0.0 Released

https://blog.jquery.com/2026/01/17/jquery-4-0-0/
62•OuterVale•1h ago•14 comments

Kip: A programming language based on grammatical cases of Turkish

https://github.com/kip-dili/kip
153•nhatcher•9h ago•49 comments

Computer Systems Security 6.566 / Spring 2024

https://css.csail.mit.edu/6.858/2024/
63•barishnamazov•5h ago•8 comments

The recurring dream of replacing developers

https://www.caimito.net/en/blog/2025/12/07/the-recurring-dream-of-replacing-developers.html
373•glimshe•15h ago•296 comments

We put Claude Code in Rollercoaster Tycoon

https://labs.ramp.com/rct
408•iamwil•5d ago•229 comments

If you put Apple icons in reverse it looks like someone getting good at design

https://mastodon.social/@heliographe_studio/115890819509545391
366•lateforwork•6h ago•159 comments

Podcasting Could Use a Good Asteroid

https://www.joanwestenberg.com/podcasting-could-use-a-good-asteroid/
13•zdw•2d ago•4 comments

Why Object of Arrays beat interleaved arrays: a JavaScript performance issue

https://www.royalbhati.com/posts/js-array-vs-typedarray
20•howToTestFE•6d ago•7 comments

Xous Operating System

https://xous.dev/
108•eustoria•3d ago•30 comments

Raising money fucked me up

https://blog.yakkomajuri.com/blog/raising-money-fucked-me-up
199•yakkomajuri•11h ago•66 comments

How London cracked mobile phone coverage on the Underground

https://www.ianvisits.co.uk/articles/how-london-finally-cracked-mobile-phone-coverage-on-the-unde...
38•beardyw•4d ago•10 comments

Claude Shannon's randomness-guessing machine

https://www.loper-os.org/bad-at-entropy/manmach.html
3•Kotlopou•5d ago•0 comments

The Olivetti Company

https://www.abortretry.fail/p/the-olivetti-company
153•rbanffy•6d ago•32 comments

Show HN: ChunkHound, a local-first tool for understanding large codebases

https://github.com/chunkhound/chunkhound
66•NadavBenItzhak•8h ago•20 comments

IRISC: An ARMv7 assembly interpreter and computer architecture simulator

https://polysoftit.co.uk/irisc-web/
23•rtybanana•5h ago•2 comments

The relentless rule of my fitness tracker

https://timharford.com/2025/10/the-relentless-rule-of-my-fitness-tracker/
10•Arnt•1h ago•2 comments

Below the Surface: Archeological Finds from the Amsterdam Noord/Zuid Metro Line

https://belowthesurface.amsterdam/en/vondsten
75•stefanvdw1•6d ago•10 comments

Light Mode InFFFFFFlation

https://willhbr.net/2025/10/20/light-mode-infffffflation/
181•Fudgel•7h ago•134 comments

U.S. Court Order Against Anna's Archive Spells More Trouble for the Site

https://torrentfreak.com/u-s-court-order-against-annas-archive-spells-more-trouble-for-the-site/
33•t-3•2h ago•12 comments

An Elizabethan mansion's secrets for staying warm

https://www.bbc.com/future/article/20260116-an-elizabethan-mansions-secrets-for-staying-warm
129•Tachyooon•13h ago•147 comments

Show HN: Speed Miners – A tiny RTS resource mini-game

https://speedminers.fun/
19•nickponline•8h ago•2 comments

The life of a playboy publisher who shaped 20th-century literature

https://www.washingtonpost.com/books/2026/01/09/bennett-cerf-biography-nothing-random-feldman-boo...
5•benbreen•5h ago•1 comments

The thing that brought me joy

https://www.stephenlewis.me/blog/the-thing-that-brought-me-joy/
86•monooso•11h ago•39 comments