Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: optimize pprof parsing in pull mode. (#628)
* perf: optimize pprof parsing in pull mode. Our profiling data suggested that a lot of time was invested in teh binary search to find locations and functions while writing scraped profiles. This is an attempt to improve the performance by preprocessing the functions and locations and putting them into a table. A benchmark is included to showcase the results with smaller and bigger profiles. As expected, there's no gain with small profiles, quite the opposite, as there's now an extra preprocessing. On the other hand, there are big gains as profiles get bigger (2x for the bigger case). While it'd be possible to find some heuristic to disable the optimization below a certain threshold, the absolute difference between small and big profiles is so big that I think it's not worth it, at least as a first approach. * Replace the map by a slice in function and location caching. * Add the bigger CPU profile to testdata. * Create a flexible data structure to find location and functions. The pprof specification doesn't guarantee that IDs are consecutive, and that is currently supported, while still providing a fast path for the commmon case in which functions and locations have (sorted) consecutive IDs starting from 1.
- Loading branch information