Avoid a DB query and improve filtering time in sortAndGetTapesForMountInfo (reported as "getTapeInfoTime")
Hello,
I'd noticed a couple of possible changes to reduce the execution time of Scheduler::sortAndGetTapesForMountInfo. The part of this function under discussion here is the duration reported as "getTapeInfoTime" in getNextMountDryRun() or getNextMount() log lines. In the case of getNextMount the "getTapeInfoTime" is part of the time spent under the global scheduler lock. Therefore reducing that time is desirable.
The points noted were
- redundancy between getTapes() and getTapesByVid() (allowing the remove one or the other)
- improve the algorithmic complexity of the first loop, which is removing items from the std::vector "potentialMounts". (e.g. by using remove_if and suitable predicate instead of erase() single elements at a time).
However I've not made an objective measurement as to the impact of these changes.
Edited by David Smith