<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV style="text-indent: -55px;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 55px; "><BR></DIV><DIV style="text-indent: 0px;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 73px; "><FONT class="Apple-style-span" color="#999999" face="Times"><I>                  </I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>Rate </I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>      </I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>with_grep with_string_cmp </I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>      </I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>with_hash</I></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 73px; "><FONT class="Apple-style-span" color="#999999" face="Times"><I>with_grep</I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>        </I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>169/s</I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>              </I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>--</I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>            </I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>-87%</I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>            </I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>-90%</I></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 73px; "><FONT class="Apple-style-span" color="#999999" face="Times"><I>with_string_cmp 1297/s</I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>            </I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>667%</I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>              </I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>--</I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>            </I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>-25%</I></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 73px; "><FONT class="Apple-style-span" color="#999999" face="Times"><I>with_hash </I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>      </I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>1723/s</I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>            </I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>918% </I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>            </I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>33%</I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>              </I></FONT><FONT class="Apple-style-span" color="#999999" face="Times"><I>--</I></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 73px; font: normal normal normal 12px/normal Times; min-height: 14px; "><FONT class="Apple-style-span" color="#999999"><BR></FONT></DIV><DIV>1. Using separate fh's seems to have avoided the problem of advantage due to order (cache vs fresh read).</DIV><DIV>2. The while (&lt;$fh&gt;) { do nothing } (the 'with_hash' approach) beats the slurp into an array read method, used by the other two, quite handily.</DIV><DIV>3. The hash method continues to kick hash vs the string compare method, and the grep method is not even close.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Thanks for your help Eric and chromatic. This was a really useful (and fun) exercise for a perennial beginner like myself.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>regards,</DIV><DIV>Tom K</DIV><DIV><BR><DIV><DIV>On May 29, 2007, at 3:54 PM, chromatic wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV>On Tuesday 29 May 2007 15:35:07 Austin Schutz wrote:</DIV><DIV><BR></DIV> <BLOCKQUOTE type="cite"><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>You are using different file reading techniques. That could be</DIV><DIV>_very_ significant. If you are going to slurp all the lines for the</DIV><DIV>string comparison you should do the same for the hash.</DIV> </BLOCKQUOTE><DIV><BR></DIV><DIV>Worse than that, the first code to read the file pays the penalty of </DIV><DIV>populating file buffers.  Subsequent reads probably all come from a warm </DIV><DIV>cache.</DIV><DIV><BR></DIV><DIV>Mixing IO with benchmarks usually skews the results heavily.</DIV><DIV><BR></DIV><DIV>-- c</DIV><DIV>_______________________________________________</DIV><DIV>Pdx-pm-list mailing list</DIV><DIV><A href="mailto:Pdx-pm-list@pm.org">Pdx-pm-list@pm.org</A></DIV><DIV><A href="http://mail.pm.org/mailman/listinfo/pdx-pm-list">http://mail.pm.org/mailman/listinfo/pdx-pm-list</A></DIV><DIV><BR></DIV> </BLOCKQUOTE></DIV><BR></DIV></BODY></HTML>