[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

RE: [FWP] beauty vs. brains



You're correct, fgets is the wrong one, haven't had to use C in a while. 
It's between "read" and "fread".


>That is bogus, because you forgot to clear $file for each iteration of
>the benchmark.

doh!

fixed version:

Size of test.txt: 4136017
Benchmark: timing 10 iterations of buf_read, do+local, local, read...
   buf_read:  7 wallclock secs ( 1.83 usr +  0.81 sys =  2.64 CPU)
   do+local: 28 wallclock secs (17.23 usr +  9.25 sys = 26.49 CPU)
      local:  1 wallclock secs ( 0.95 usr +  0.49 sys =  1.44 CPU)
       read:  2 wallclock secs ( 0.96 usr +  0.40 sys =  1.36 CPU)

Size of test.txt: 210013
Benchmark: timing 1000 iterations of buf_read, do+local, local, read...
   buf_read:  9 wallclock secs ( 5.35 usr +  2.48 sys =  7.83 CPU)
   do+local:  9 wallclock secs ( 5.98 usr +  3.09 sys =  9.06 CPU)
      local:  8 wallclock secs ( 5.02 usr +  2.68 sys =  7.70 CPU)
       read:  7 wallclock secs ( 4.28 usr +  2.04 sys =  6.32 CPU)

Size of test.txt: 148
Benchmark: timing 10000 iterations of buf_read, do+local, local, read...
   buf_read:  9 wallclock secs ( 1.25 usr +  4.76 sys =  6.01 CPU)
   do+local: 10 wallclock secs ( 1.44 usr +  4.93 sys =  6.37 CPU)
      local:  9 wallclock secs ( 1.40 usr +  4.74 sys =  6.14 CPU)
       read: 15 wallclock secs ( 1.60 usr +  7.30 sys =  8.90 CPU)

draw your on conclusions.


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe