#!/usr/bin/perl
use strict;
use warnings;
use BerkeleyDB;
my $db_file = '/home/snowhare/perl_monks/example.db';
unlink $db_file;
my $db = BerkeleyDB::Btree->new( -Filename => $db_file,
-Cachesize => 700_000_000,
-Flags => DB_CREATE,
);
srand;
for(my $count = 0; $count < 12_000_000; $count++) {
my $random_value = rand(16776216);
my $status = $db->db_put( "$random_value" => "$count" );
}
undef $db;
[snowhare@blue-bay perl_monks]$ time ./big_btree.pl
real 3m47.121s
user 3m7.978s
sys 0m4.884s
This was on a desktop class machine with 1.5GBytes of RAM and an AMD Athlon 64 3000+ processor running Fedora Core 6 Linux.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|