Cache counter values, avoiding I/O when it doesn't change.

This improves merge times by up to 25%, since looping over the vardb for
each package install is slow.

TEST=Emerge a bunch of packages, notice 25% speed improvement.

Change-Id: I51dd617219cd1820ceeb702291bd790990995be4
(cherry picked from commit 928bc527a8c3eab3784df54226df2f2d83c6c85c)

get_counter_tick_core: use cpv_all

It's more efficient to use cpv_all since cp_all calls cpv_all anyway,
and calls to cp_list induce additional stat calls.
(cherry picked from commit e5a51b2b7952eabc56bed8e2e04b2596e7495e16)

depgraph: don't clear vardbapi cache in _load_vdb

Most of the memory is probably held on the heap by the installed
package instances anyway, and the cache is useful for being inherited
by subprocess in MergeProcess.
(cherry picked from commit d124a775634706eb954fa70116de8367f165d1d5)
3 files changed