in reply to How best to tell when my hash is "full" (all values defined)?
Method 1 is foreach my $line (`top -b -n 1`) and creating the hash keys as we go. Method 2 is foreach my $line (`top -b -n 1`) and precreating the hash keys. Method 3 is foreach my $line (@raw) where @raw=`top -b -n 1`and precreating the hash keys. Method 4 is while (my $line = <TOP>) with open(TOP, "top -b -n 1|") and precreating the hash keys. Method 1 mean: 0.560507924556732 stddev: 0.00320759260168446! Method 2 mean: 0.560737266540527 stddev: 0.00290542841782241! Method 3 mean: 0.561151208877563 stddev: 0.00359781593804784! Method 4 mean: 0.558518676757812 stddev: 0.00518282488688389! T-stat for mean 1 and mean 2 is 0.529922998231174 T-stat for mean 1 and mean 3 is 1.33459955560607 T-stat for mean 1 and mean 4 is 3.26368009466516 T-stat for mean 2 and mean 3 is 0.895111546983644 T-stat for mean 2 and mean 4 is 3.73396330152602 T-stat for mean 3 and mean 4 is 4.17253188415264
Note that I did not throw away outliers, and I have no control over what other users were doing on the machine, so this is by no means rigorous, yet I think it's still useful. I think it's pretty clear that piped opens beat the other methods hands down--good call, McDarren!
Anyway, this led me to try another combination with the same methodology and under the same conditions, the results of which follow:Method 1 is while (my $line = <TOP>) with open(TOP, "top -b -n 1|") and creating the hash keys as we go. Method 2 is while (my $line = <TOP>) with open(TOP, "top -b -n 1|") and precreating the hash keys. Method 1 mean: 0.557748141288757 stddev: 0.00368823257386979! Method 2 mean: 0.558288831710816 stddev: 0.00673477747628604! T-stat for mean 1 and mean 2 is 0.704155995405561A t-stat of 0.7 for r=100 gives you a confidence of between 75 and 90%; that's not bad. It might be just as much an artifact of the escape clause as anything else, but it's interesting.
Code available upon request.
Thanks again,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How best to tell when my hash is "full" (all values defined)?
by OfficeLinebacker (Chaplain) on Dec 18, 2006 at 18:10 UTC |