I avoided allocating useless arrays for the result
Your benchmark is completely unrealistic, chalk & cheese comparison, and thus totally broken.
- keys & values used in void context:>
From perlfunc:
- "In particular, calling keys() in void context resets the iterator with no other overhead."
- "(In particular, calling values() in void context resets the iterator with no other overhead.)"
- Whilst grep in a void context probably avoid generating the return list; it doesn't stop it from iterating the entire input list.
Benchmark code that doesn't actually produce the required result is broken. And broken, is just broken; of no value at all.
Obviously vec scales badly the sparser the distribution of values become...
Think again.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.