Hacker Newsnew | past | comments | ask | show | jobs | submit | forinti's commentslogin

So if you need speed, you just have to swallow your OO programmer's pride and put your data in arrays.

If you have hot loops with millions of iterations at a time, structure your code accordingly. Its not anti-OO to choose the right data structure for the job.

And avoid moving said data between physical threads as much as possible.

Most of the bottlenecks I see are not due to the organization of data. Unnecessary communication of data is the #1 offender.


Working set and algorithm diagonalization (work independence) FTW. Immutable data structures and copying often helps to avoid cache invalidation penalties.

If you had the right language you could use AoS syntax with SoA implementation. I heard Jai was going to have this feature?

... IF that's your main performance problem.

I already know I'm dealing with huge perf issues caused by ORM & lazy-load semantics. I/O abuse is usually going to be so, so much worse than memory/cache issues. Java is mainly used for business information systems, where I/O is king. Plain vanilla memory abuse is also a big one.

But my main problem is a mgmt convinced the magic wand of AI will make all sorts of problems dissapear, and it's going to take 5 years for them to realize nope.

It's still fun to learn about cache optimization though, esp. when someone makes it reasonably digestible like this. And maybe it also helps people to recognize that OOP is not some great over-arching zen truth of truths.


Maybe someone can write an OO language where arrays of structs are automatically stored as structs of arrays.

mild /s


Odin has some helpers, was one of the more interesting features I found, but never tried. Not sure if you want to consider Odin OO, but well https://odin-lang.org/docs/overview/#soa-struct-arrays

Odin is heavily inspired by the lang he or she is referring to!

A sibling comment also mentioned Jai. Not sure what I am missing that the original post was explicitly referring to Jai, some inside joke maybe?

I am sorry, I only know Odin. Jai is this cult on reddit/discord, right? You get access if you socialize enough or something? Not my thing. Not for a language.


(original poster here)

I was just throwing out an idea. I had no idea there were already implementations! Because, to my knowledge, conventional popular languages like C/C++/C#/Java/JS/Python don't do that, and automatically doing that (under certain conditions) feels like an easy performance win.


For what it’s worth, a common example of the capabilities of c++26 reflection is exactly this use case. I can’t remember where I first saw it, but this article [0] showcases the technique pretty well. It’s opt-in so not the compiler optimization that you’re imagining but still neat that it’s possible

[0] https://brevzin.github.io/c++/2025/05/02/soa/


Ah. So, the context (Which I read too far into evidently): 1: One of Jai's initial primary marketing points was to address exactly this: SoA performance with AoS ergonomics. 2: Odin is (or was initially) inspired by Jai.

There's a package to do this in Julia: https://juliaarrays.github.io/StructArrays.jl/stable/

Are you talking about Zig's MultiArrayList?

He is talking about jai the programing language from Jonathan Blow, which is quite cool but there is no way to access it.


Exactly. There are many costs associated with data centers regardless of the type of data processing they do.

There's a story about some Kenyans outrunning a Cheetah in 6km. It had been killing their livestock, so they decided to go after it.

Cheetahs are very fast, but humans have way more endurance.


> Cheetahs are very fast, but humans have way more endurance.

https://en.wikipedia.org/wiki/Man_versus_Horse_Marathon

> The Man versus Horse Marathon is an annual race over 21 miles (34 km), where runners compete against riders on horseback through a mix of road, trail and mountainous terrain. The race, which is a shorter distance than an official marathon road race, takes place in the Welsh town of Llanwrtyd Wells every June.

> ...

> The event started in 1980, when local landlord Gordon Green overheard a discussion between two men in his pub, the Neuadd Arms. One man suggested that over a significant distance across country, man was equal to any horse. Green decided that the challenge should be tested in full public view, and organised the first event.

While the horses had a string of wins from 2008 to 2019, 2022 to 2025 had three wins for humans and one win for a horse.

The next race event: https://www.green-events.co.uk/man-v-horse


The Man vs Horse marathon is interesting but in a real race we have no actual chance of winning.

There are horse endurance races where the winner arrived in 7,5 hours after 160km[1]. That's a sub 2-hours marathon almost 4 times in a row (not to mention with a guy on your back).

[1] https://eatnstays.com/uaes-almazrouei-wins-almutadil-cup-at-...


“in a real race we have no actual chance of winning” is an absolutely wild thing to say in response to a link to a real race in which the human has won the last few years in a row.

The race is pretty much designed to be a difficult for horses as possible to give humans a chance. Except for the parts that are extremely difficult for horses, horses steamroll the human competitors.

https://youtu.be/FY9Ee6-CIFM?t=342


I think it implies that the best competitors are not participating.

Neither are the best humans in that particular race.

Fair, but if you had a cycle vs foot race where one wasn't consistently on top, you'd probably say it wasn't a real competition.

That time doesn't include most of the 40-50 minutes the horse must rest between laps. The total time from start to finish was just over 11 hours.

https://www.enduranceonline.it/live/cat/V.php?gara_id=1911&v...


Wow, seems surprisingly balanced. I would guess that if it was 50% longer distance than humans would win reliably, and 50% shorter would allow the horses to win?

Think it's more to do with hilly, wooded courses unfavourable to horses and a requirement that the horse's heart rate remain below a certain threshold when inspected by a vet in the middle and end of a course, whereas the leading humans are maxing out their efforts

I don't think the Mongol cavalry would lose races to humans over any distance of steppe


To be fair you can run a horse to death in a race, a human however isn't likely to die from running a race even to their physical limits.

Yeah I think on say, a proper road the horse would win at any distance.

the road adds some infrastructure - i think at that point the person should get a bike?

1990: For a few joyous years there was the Man v Horse v Bike competition in Mid-Wales - https://youtu.be/vFlglZUIKO8

Well that’s just not fair. Even the fastest human on earth can’t be expected to keep up with a horse riding a bike.

There's probably some upper limit to it, i am not sure a horse could live through the ultra marathon moab race in the western us.

The weather conditions also impact it significantly.

https://www.outsideonline.com/health/training-performance/hu...

> Lobb’s victory came on a hot day, as did Florian Holzinger’s subsequent victory in 2007—a significant detail, according to a new study in the journal Experimental Physiology from Lewis Halsey of the University of Roehampton in Britain and Caleb Bryce of the Botswana Predator Conservation Trust. Halsey and Bryce gathered historical data from three endurance races that pit humans against horses, including the Man Versus Horse Marathon, to test the idea that humans are uniquely adapted to run for long distances in hot weather.

> This idea has been around since the 1980s, and it gained prominence when Harvard anthropologist Daniel Lieberman and University of Utah biologist Dennis Bramble published a 2004 Nature paper hypothesizing that running had “substantially shaped human evolution.” They argued that our ability to keep running at a moderate pace even on hot days allowed us to run prey like kudu to exhaustion or outcompete other animals in the race to scavenge carcasses left by other large predators.

There's a plot with the analysis of the Old Dominion with weather stations in there that show a steeper negative slope for horses compared to the humans.

> Overall, for every increase of 1 degree Celsius (1.8 degrees Fahrenheit), the horses slowed down by about 1 percent—or 0.07 miles per hour, to be precise. The humans, on the other hand, slowed down by just 0.04 miles per hour for each extra degree of heat. That 36 percent advantage for the humans was statistically significant.

---

For the Man vs Horse, the weather conditions ("Hot", "Rain/sun/windy" - not exact values)... the entry for 2022 was the human winning by 1:51 on a warm day, and 2023 was a human wining by 9:44 on a sweltering day.


There was a great radiolab episode about it a few years ago but I remember it being in Utah not UK

https://radiolab.org/podcast/man-against-horse

https://en.wikipedia.org/wiki/Man_versus_Horse_Marathon

> ... There are other Man versus Horse races — in Scotland based at Dores, near Loch Ness, in Central North Island, New Zealand and in the U.S. city of Prescott, Arizona.

And the Arizona race page: https://managainsthorse.com


I think the term is persistence hunting (https://en.wikipedia.org/wiki/Persistence_hunting). There was an intriguing blog post years ago (which sadly I can’t find) about how terrifying a fictional portrayal of persistence hunting would be- grinding down prey through exhaustion, thinking you’ve escaped but being slowly tracked down.


The fact that no one in that movie considered placing a treadmill at a strategic point vexed me to no end.

To what end? Such that you can wait out your days in a secluded bunker posting online trying to convince anyone to believe you as to the reason you've put yourself in the bunker?

Because otherwise, 'it' will just back out of your trap and go along to continue to follow, wouldn't it?


You have to admit it would be a very good Treehouse of Horror gag.

There's also the story "Go, Go, Go, Said the Bird" by Sonya Dorman in the first Dangerous Visions which is like this, in a way.

There’s also “the ruum” by Arthur Porges[0]. We got as part of English class in high school, a long time ago.

Try not to read the Wikipedia as it might spoil the short story, there’s the pdf available on the web somewhere

[0] https://en.wikipedia.org/wiki/The_Ruum


Yes! I remember reading that, as you say, a long time ago. This is the first time I’ve seen someone else reference it. I love that story.

I read it too in school. I thought it was super obscure!

That is how wolves hunt. Their system includes switching leads to maintain pressure on the prey while maintaining the packs endurance.

Wooly Mammoth basically living out the plot of It Follows.

Somehow that reminds of the old B-movie Surviving the Game with Ice-T.

Basically The Terminator following you around.

Which only leads us to another problem: food.

You can't have a healthy society if all policies are dictated by corporations.


Probably more of a city design problem. Even modest exercise like walking your 8000 steps has a huge effect size. Exercise is a much more effective intervention than diet alone. America is designed to make people fat. There are places in America that don't have sidewalks. Sidewalks! It'd be funny if people weren't dying from it

There’s a fascinating case study on how this happens - Mexico had population much less overweight than USA until NAFTA was agreed to and cheap USA processed foods began inroads so that now Mexico has close to the same obesity issue that the USA has.

Could it also be highest per-capita calories from sugary drinks?

Funny you should mention this. Every time I see something related to MSX, I can sense the smell of the plastic.

I'm pretty sure the genie will put itself back in the bottle when the bubble bursts. But it will leave its tail outside.

Calculators give you the right answer. AI gives you any answer. I work within a bureaucracy and instead of optimising processes and getting rid of useless documents, AI is being used to generate more useless text. It is the industrialisation of bureaucracy and it is a turbo powered waste of resources.

Then your issue isn't with AI, it's with your bureaucracy. Just because your company is holding it wrong doesn't mean the entire technology is morally fraught.

If your company's goal is to generate "more useless text" they would have done it with or without AI. AI just let's the peons responsible for producing that text do so significantly faster, with some percentage loss in "quality" baked in. Are you mad their jobs are easier? Was their text once not useless and now it is?

Again, it's like saying the conveyor belt is evil because it lets us generate more useless toys/candy/guns/... and research into improving the conveyor belt should instead be going toward more valuable things. However it ALSO has those effects on EVERYTHING. It lets you produce more drugs, books, food, clothes, necessities, and yes, some useless items too.

Same with AI. Sure you can use it to spew cat pictures, but you can also use it to generate significant quantities of non-trivial useful (not necessarily bullet proof, but undoubtedly _useful_) output in a fraction of the time and/or HUMAN capital (butts-in-seats, time-on-task, ...) than before. Now, as always, value is in the eye of the beholder (which is why your C suite gets giddy at all the useless text output).


I have had a little success by arguing that "we can live without AI, but we can't live without X" and then I've managed to get some priorities in order. The AI craze is insane and it does have some support inside IT but it's the pressure from outside that's hard to resist.

I spent many holidays in Uruguay in the 80s and early 90s.

I loved cartoons, but TV was only on at 10am, so I had to go out and play. If we went to my grandparents' beach house, there was an old vacuum tube TV that took hours to heat up so mostly I didn't bother to use it. I watched Tyson's defeat to Buster Douglas on that TV and the next morning there was still a little point of light in the centre of the screen because it also took a long time to go completely blank.

So not having access to TV was liberating. I wouldn't mind having no Internet on weekends today.


Easily configurable via router rules at home!

> It also promoted a strongly anti-communist ideology, arguing that racial equality was a communist plot to destroy the country.

This has to be the most cynical "communist threat" ever.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: