>>>>> "CW" == Conor Walsh <c...@adverb.ly> writes:

  CW> Uri noted a couple days ago that Perl's stream I/O in <FH> calls is
  CW> terrible.  This matches somewhat with my own experience, and whenever
  CW> I need to parse a file I either slurp it (if I'm certain it's within
  CW> certain bounds) or do something like while {sysread(LARGE_BUFSIZE)}.

  CW> Is anyone here perlgutsy enough to say *why* <FH> is so slow?  Is it
  CW> just the split /(?=$/)/, or is there more going on there that I'm
  CW> missing?

  CW> If I bypass <FH>, am I gaining speed by not doing work I don't need to
  CW> do, or is it just one of the more atrocious legacy code paths?

my guess is that stdio does more work than needed for slurping. it does
buffering with smaller reads, it does line ending, it does eof checking,
etc. it is designed for flexibility rather than speed. i also bet it has
a large tree of sub calls to do its work. stdio does many things which
aren't needed for just slurping in a file.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

_______________________________________________
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to