Results using the slow functions

Benchmark: timing 10 iterations of berkeley write, file write... berkeley write: 132 wallclock secs (32.46 usr + 20.78 sys = 53.24 CPU) + @ 0.19/s (n=10) file write: 61 wallclock secs (24.18 usr + 12.72 sys = 36.90 CPU) @ 0 +.27/s (n=1 0) s/iter berkeley write file write berkeley write 5.32 -- -31% file write 3.69 44% -- Benchmark: timing 10 iterations of berkeley read, file read... berkeley read: 179 wallclock secs (11.48 usr + 7.47 sys = 18.95 CPU) +@ 0.53/s (n=10) file read: 225 wallclock secs ( 7.72 usr + 6.81 sys = 14.53 CPU) @ +0.69/s (n= 10) s/iter berkeley read file read berkeley read 1.89 -- -23% file read 1.45 30% --

Results using the faster functions. This shows a very nice boost to file read and a modest boost to BerkeleyDB read and write.

Benchmark: timing 10 iterations of berkeley write, file write... berkeley write: 96 wallclock secs (25.64 usr + 21.62 sys = 47.26 CPU) +@ 0.21/s (n=10) file write: 58 wallclock secs (23.88 usr + 13.41 sys = 37.29 CPU) @ 0 +.27/s (n=1 0) s/iter berkeley write file write berkeley write 4.73 -- -21% file write 3.73 27% -- Benchmark: timing 10 iterations of berkeley read, file read... berkeley read: 163 wallclock secs (10.58 usr + 7.83 sys = 18.41 CPU) +@ 0.54/s (n=10) file read: 135 wallclock secs ( 8.21 usr + 6.12 sys = 14.33 CPU) @ +0.70/s (n= 10) s/iter berkeley read file read berkeley read 1.84 -- -22% file read 1.43 28% --

My alteration to perrin's benchmark

--- perrin-bench.pl Tue Mar 18 11:41:42 2003 +++ perrin-bench2.pl Tue Mar 18 12:00:06 2003 @@ -28,9 +28,9 @@ sub read_file { my $key = shift; my $file = "$file_dir/$key"; + my $value; open(FH, '<', $file) or die $!; - local $/; - my $value = <FH>; + read FH, $value, (stat FH)[7]; close FH; return $value; } @@ -52,20 +52,22 @@ 'berkeley write' => sub { for (0..1000) { - $db_obj->STORE($_, $_ x 8000); + $db_obj->db_put($_, $_ x 8000); } }, }); cmpthese(10, { 'file read' => sub { + my $test; for (0..1000) { - read_file($_); + $test = read_file($_); } }, 'berkeley read' => sub { + my $test; for (0..1000) { - $db_obj->FETCH($_); + $db_obj->db_get($_,$test); } }, });

In reply to Re^2: BerkeleyDB vs. Linux file system by diotalevi
in thread BerkeleyDB vs. Linux file system by perrin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.