Earlier quoted context omitted.
What would be your opinion of this comment, though? // Reset the counter for the next run total_count = 0;
it feels like this suggests a design flaw. You should probably be creating a new local `total_count` variable for each run that goes out of scope at the end of the run, rather than reusing the same variable over and over again in different contexts
// reuse counter for performance, this brings 2% speedup
total_count = 0;
would be a quite useful why comment, if not creating a new variable each time is intentional