Optimized HashTable size calculation