5 ms·
Once I’ve done the dead obvious bits I start looking at invocation counts, on two fronts. Not enough is said about running a subsystem a deterministic number o
by hinkley 3y ago
Once I’ve done the dead obvious bits I start looking at invocation counts, on two fronts.
Not enough is said about running a subsystem a deterministic number of times and then evaluating the call counts. Invariably there is some method that is being called 2x as often as the requirements and architecture dictate (scenario one above). Someone just goofed, forgot they already had an answer, or part of one.
And then they’re the “profilers lie” part. If you have two functions that take 4.5% of overall time, and one is called 25k times, while the other is called 250k times, the chances of bookkeeping errors in the latter are much higher. It could be 4%, or it could be 10%. When in doubt, sort by invocation count and try another optimization pass.
I’ve also seen a variation on this in GC languages - one periodic large allocation gets stuck doing a full GC almost every time, because a dozen little methods are churning out garbage at a tempo that keeps missing the GC threshold because of the periodic allocation, which keeps raising the heap size toward whatever max you’ve set. To an extent cache smashing does the same thing. Little invalidations make problems for bigger methods.
- nerpderp82 3y agoIt situations like this, Off Heap Collections or an Array of primitive values can reduce GC churn and pressure.