[HN Gopher] Bytes before FLOPS: your algorithm is (mostly) fine,...
___________________________________________________________________
Bytes before FLOPS: your algorithm is (mostly) fine, your data
isn't
Author : bofersen
Score : 8 points
Date : 2025-11-23 15:47 UTC (7 hours ago)
(HTM) web link (www.bitsdraumar.is)
(TXT) w3m dump (www.bitsdraumar.is)
| jmole wrote:
| > worst case scenario being the flat profile where program time
| is roughly evenly distributed
|
| It sounds like the "worst case" here is that the program is
| already optimized.
| bofersen wrote:
| Author here, kinda sorta. I should've been a bit more specific
| than that. You can have a profile showing a function taking up
| 99% of the time, but when you dive into it, there's no clear
| bottleneck. But just because there's no bottleneck, that
| doesn't mean it's optimized; vice versa-a well-optimized
| program can have a bottleneck that's already been cycle-
| squeezed to hell and back.
|
| What I wanted to say was that a spiky profile provides a clear
| path to optimizing a piece of code, whereas a flat profile
| usually means there are more fundamental issues (inefficient
| memory management, pointer chasing all over the place,
| convoluted object system, etc.).
| colonCapitalDee wrote:
| Great article. Can confirm, writing performance focused C# is
| fun. It's great having the convenience of async, LINQ, and GC for
| writing non-hot path "control plane" code, then pulling out
| Vector<T>, Span<T>, and so on for the hot path.
|
| One question, how portable are performance benefits from tweaks
| to memory alignment? Is this something where going beyond rough
| heuristics (sequential access = good, order of magnitude cache
| sizes, etc) requires knowing exactly what platform you're
| targeting?
___________________________________________________________________
(page generated 2025-11-23 23:01 UTC)