ocehb: (Default)
[personal profile] ocehb


>perl -MBenchmark=timethese -e "timethese ($ARGV[0],\
  {'A' => sub { open F,$ARGV[1]; local $/; my $a = <F>; },\
   'B' => sub { open F,$ARGV[1]; my $a = join '',<F>; } } )" 100000 file

результаты:

> wc -l my.xml & ls -alF my.xml
      2 my.xml
-rw-rw-rw-   1 user     group      115710 Jan 19 10:40 my.xml

Benchmark: timing 100000 iterations of A, B...
         A: 84 wallclock secs (53.73 usr + 22.66 sys = 76.39 CPU) @ 1309.07/s (n=100000)
         B: 150 wallclock secs (113.45 usr + 28.98 sys = 142.44 CPU) @ 702.06/s (n=100000)

> wc -l sequencer.pm & ls -alF sequencer.pm
    926 sequencer.pm
-rw-rw-rw-   1 user     group       36706 Dec 19 08:29 sequencer.pm

Benchmark: timing 100000 iterations of A, B...
         A: 40 wallclock secs (18.08 usr + 18.14 sys = 36.22 CPU) @ 2761.06/s (n=100000)
         B: 551 wallclock secs (515.11 usr + 21.98 sys = 537.09 CPU) @ 186.19/s (n=100000)

>wc -l test & ls -alF test
      3 test
-rw-rw-rw-   1 user     group          15 Feb  9 11:03 test

Benchmark: timing 100000 iterations of A, B...
         A: 22 wallclock secs ( 3.69 usr + 15.03 sys = 18.72 CPU) @ 5342.17/s (n=100000)
         B: 21 wallclock secs ( 3.94 usr + 13.80 sys = 17.73 CPU) @ 5638.89/s (n=100000)

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org

Profile

ocehb: (Default)
ocehb

January 2021

S M T W T F S
     12
345 6789
10111213141516
17181920212223
24252627282930
31      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 6th, 2026 12:22 am
Powered by Dreamwidth Studios