Some runtime optimisations to heaptrack (GUI), happy to provide patches

Hello!

Would there be any interest in some runtime optimisations for heaptrack GUI?

One of the pain points of working with heaptrack has been the GUI, where loading up a very large profile would sometimes take over an hour on a pretty beefy CPU with a modern SSD. Unfortuntely not an uncommon occurrence in my domain.

To overcome this limitation, I have a bunch of modifications for the heaptrack codebase
(in order of load time savings, largest first):

  1. Merge stage 1 & 2 of the GUI loading process (3 → 2 stages)
  • Reduces load time by 1/3
  • Constant memory overhead (Currently tuned to 1MB)
  • Broke some unit tests in the process, would love some help to fix those
  1. further inline and handroll getline & memchr (to find end-of-line), avoid string copies whenever possible

  2. Optimise for cache locality, manage register pressure, devirtualise some functions

  3. Branchless implementation of readHex

Some less portable or controversial(?) changes

  1. Optimise memchr with hand-rolled SSE implementation
  2. Remove support for older heaptrack file formats
  3. Bumped the build to C++20

With those changes, I’m seeing 7x faster load times consistently across profiles of all sizes. Of course, YMMY.

I’m more than happy to put together a series of patches for any of the aforementioned changes.

Thanks!

4 Likes

I have no doubt that the heaptrack devs would be very happy to see your patches.

3 Likes

Awesome. Should I wait for the heaptrack maintainers to give their blessing here? Would be an unsolicited MR be welcome?

I am sure you can just submit MRs :slight_smile:

I’ve already sent the link to this thread to the maintainer so he should be aware when they appear.

2 Likes

Thanks guys :+1:.

Submitted MR part 1 of N, should cut down heaptrack GUI load time by 1/3
(See MR #45)

1 Like