Moves activity filtering (Function and TemplateInstantiation) to happen as soon as activity stops instead of keeping everything in memory alongside a list of filtered activities that only get applied when exporting.
Now, we keep less things in memory and iterate over less entries when exporting, making the overall process faster. In fact, in my old laptop it's two orders of magnitude faster when analyzing a 3.3 GB trace full of small functions.
Not only that, but my laptop doesn't page memory with that trace anymore, which heavily impacts speed. It created so many TimelineEntry instances that it would take over 30 minutes after the execution had finished just executing destructors and all.
As a side-effect, this PR fixes a bug where an entry with filtered out children would get exported as a pair of B and E events, when it should've been an X event. Now, because that same entry effectively has no children when we get to export it, will use the correct event type. This makes .json traces a bit smaller as well (how small depends on the number of filtered entries).
Based on my contribution in https://github.com/microsoft/vcperf/pull/8/commits/a02d58851e71fd7bae208b9b6f5fae7c10d6da83.
Moves activity filtering (
Function
andTemplateInstantiation
) to happen as soon as activity stops instead of keeping everything in memory alongside a list of filtered activities that only get applied when exporting.Now, we keep less things in memory and iterate over less entries when exporting, making the overall process faster. In fact, in my old laptop it's two orders of magnitude faster when analyzing a 3.3 GB trace full of small functions. Not only that, but my laptop doesn't page memory with that trace anymore, which heavily impacts speed. It created so many
TimelineEntry
instances that it would take over 30 minutes after the execution had finished just executing destructors and all.As a side-effect, this PR fixes a bug where an entry with filtered out children would get exported as a pair of
B
andE
events, when it should've been anX
event. Now, because that same entry effectively has no children when we get to export it, will use the correct event type. This makes.json
traces a bit smaller as well (how small depends on the number of filtered entries).