bitbake: codeparser cache improvements
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 25 Jul 2014 13:54:23 +0000 (14:54 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 26 Jul 2014 07:50:14 +0000 (08:50 +0100)
commitd55a5648c02273f109e468941ebe509368f852b3
tree624e8a318c4ad1d7e31a01d32f4b2eb50d0b9a3e
parentd74fb9276b45fbcf6b535aa209c428ddc0e7a0b5
bitbake: codeparser cache improvements

It turns out the codeparser cache is the bottleneck I've been observing when running
bitbake commands, particularly as it grows. There are some things we can do about
this:

* We were processing the cache with "intern()" at save time. Its actually much
  more memory efficient to do this at creation time.

* Use hashable objects such as frozenset rather than set so that we can
  compare objects

* De-duplicate the cache objects, link duplicates to the same object saving
  memory and disk usage and improving speed

* Using custom setstate/getstate to avoid the overhead of object attribute names
  in the cache file

To make this work, a global cache was needed for the list of set objects as
this was the only way I could find to get the data in at setstate object creation
time :(.

Parsing shows a modest improvement with these changes, cache load time is
significantly better, cache save time is reduced since there is now no need
to reprocess the data and cache is much smaller.

We can drop the compress_keys() code and internSet code from the shared cache
core since its no longer used and replaced by codeparser specific pieces.

(Bitbake rev: 4aaf56bfbad4aa626be8a2f7a5f70834c3311dd3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/bb/cache.py
bitbake/lib/bb/codeparser.py