News for hackers. Stuff that matters.
Re:Conservative GC can be faster than precise GC by cogman10 on Saturday September 07, 2024 @02:26PM (#41475495)
Fortunately, at least in my experience, the variability that CPUs introduce (which do matter in many contexts) aren't often the source of slowness. In my experience plain old algorithmic complexity would go a long way in making stuff faster.

I can't tell you the number of times I've fixed code like this

    matches = []
    for (first : items) {
      for (second : items) {
        if (first.name == second.name)
          matches.add(first);
     }
    }
Very frequently a bright red spot in most profiler output.
Re:Conservative GC can be faster than precise GC by marginalia_nu on Saturday September 07, 2024 @03:27PM (#41475870)
I think there's an element of selection bias in that observation. Since that is the type of performance issue that a profiler is good at finding, those are the performance issues you'll find looking at a profiler.
Re:Conservative GC can be faster than precise GC by cogman10 on Saturday September 07, 2024 @04:07PM (#41476137)
> I think there's an element of selection bias in that observation.

Almost certainly true, I can only speak of my own experiences.

> Since that is the type of performance issue that a profiler is good at finding, those are the performance issues you'll find looking at a profiler.

I have to disagree with you on this. Sampling profilers are good at finding out exactly what methods are eating performance. In fact, if anything they have a tendency to push you towards looking at single methods for problems rather than moving up a layer of two to see the big picture (it's why flame graphs are so important in profiling).

I have, for example, seen plenty of times where the profiler indicated that double math was the root cause of problems yet popping a few layers up the stack revealed (sometimes non-obviously) that there was n^2 behavior going on.