News for hackers. Stuff that matters.
Re:Ask HN: What were the things you did that made the bigges... by bertr4nd on Saturday February 01, 2020 @12:44PM (#22211833)
I wrote a little tool that used perf profiles from our production fleet to generate a custom linker script that reordered our main server program’s binary to be significantly more cache friendly. The heuristic I came up with for reordering was one of the few (maybe the only) genuine “eureka” moments I’ve had in my career.

And the performance win was extremely nice :-)

Re:Ask HN: What were the things you did that made the bigges... by JustAPerson on Saturday February 01, 2020 @01:55PM (#22212412)
For anyone curious about using something like this technique, Facebook has a similar tool.

https://github.com/facebookincubator/BOLT

Re:Ask HN: What were the things you did that made the bigges... by bertr4nd on Saturday February 01, 2020 @03:00PM (#22212850)
Yes! In fact that’s from the same team I was working on at the time (HHVM). My tool predated BOLT by a few years, I think. Obviously BOLT is way more sophisticated and does an even better job.
Re:Ask HN: What were the things you did that made the bigges... by sevengraff on Saturday February 01, 2020 @01:24PM (#22212163)
Interesting, got a blog that goes into more detail?
Re:Ask HN: What were the things you did that made the bigges... by bertr4nd on Saturday February 01, 2020 @02:51PM (#22212791)
We wrote this paper about it for CGO: https://research.fb.com/publications/optimizing-function-pla....

But the paper actually describes a significantly more sophisticated heuristic. My initial implementation simply used the number of perf samples divided by the size of the function, which helps make sure you’re getting the most out of your I-TLB. It worked shockingly well for its simplicity.