note
merlyn
<blockquote><i>
However, loading the same 1 million integers into a hash as keys, with undef as the value requires 95 MB!
</i></blockquote>
I stopped reading there. I don't see your point. Besides storing all the data, you now have a meta-data structure that can tell you rather rapidly if $x is a member of this set you've created, as well as associate another scalar with each of those million keys!
<p>
You've got a lot more information than what you started with. You're not merely storing the keys.
<p>
If your complaint is that you want to be able to just store the keys, then yes, a hash was a bad choice, as you go on to point out.
<p>
But don't fault Perl's hash structure. It's very efficient for the task at hand.
<div class="pmsig"><div class="pmsig-9073">
<p>-- [http://www.stonehenge.com/merlyn/|Randal L. Schwartz, Perl hacker]
<br>
Be sure to read [id://205373|my standard disclaimer] if this is a reply.</p>
</div></div>
308947
308947