Problems? Is your data what you think it is? | |
PerlMonks |
Re^3: Fast Sets of Scalars in Perlby kyle (Abbot) |
on Jan 07, 2008 at 18:05 UTC ( [id://660890]=note: print w/replies, xml ) | Need Help?? |
I stand corrected.
Changing $set{$i}=undef to $set{$i}=1:
Using undef instead of 1, you save about 78M on ten million items—about a 6% difference. Or you could look at it as 8 bytes per item, unless I did my math wrong (which becomes more and more probable as time t approaches lunch). When $set{$i}=10 (no chance of using sv_yes):
When $set{$i}='' (empty string):
And finally, Set::Light:
It beats them all! It beats the undef case by 195M. Note, however, that most of my tests ran in 20–25 seconds. The Set::Light test took much much longer—almost four minutes. I'm pretty sure all that time is spent in destruction, because the test reports its results fairly quickly and then takes a long time to exit.
In Section
Seekers of Perl Wisdom
|
|