Caching bitmaps for quicker bitmap2terms

@rhyolight