<?xml version="1.0" encoding="windows-1252"?>
<node id="308981" title="•Re: A (memory) poor man's hash" created="2003-11-21 12:52:36" updated="2005-07-14 22:40:36">
<type id="11">
note</type>
<author id="9073">
merlyn</author>
<data>
<field name="doctext">
&lt;blockquote&gt;&lt;i&gt;
However, loading the same 1 million integers into a hash as keys, with undef as the value requires 95 MB!
&lt;/i&gt;&lt;/blockquote&gt;
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!
&lt;p&gt;
You've got a lot more information than what you started with.  You're not merely storing the keys.
&lt;p&gt;
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.
&lt;p&gt;
But don't fault Perl's hash structure.  It's very efficient for the task at hand.
&lt;div class="pmsig"&gt;&lt;div class="pmsig-9073"&gt;
&lt;p&gt;-- [http://www.stonehenge.com/merlyn/|Randal L. Schwartz, Perl hacker]
&lt;br&gt;
Be sure to read [id://205373|my standard disclaimer] if this is a reply.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
308947</field>
<field name="parent_node">
308947</field>
</data>
</node>
