speed up simhash calculation with caching and integer frequencies