(2) hash access slows disproportionately whereas this lookup could just be an array. That array could be packed down to one bit per element for the most efficient storage, given that it has only boolean values. Lookup (and registration) can be achieved without unpacking from that using bit operators such as '<<' and '&', thereby winning on processing as well as storage.
|Replies are listed 'Best First'.|
Re^3: Unable to Understand grep and hash use for prime no.
by anonymized user 468275 (Curate) on Aug 04, 2015 at 18:26 UTC