summaryrefslogtreecommitdiff
path: root/regress/base/search_max_id.pl
blob: 369769c1a631fb697b63039e6564f5e3aa772fdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env perl
#-*- perl -*-
#
#  Copyright (C) 2001,2002 Ken'ichi Fukamachi
#   All rights reserved. This program is free software; you can
#   redistribute it and/or modify it under the same terms as Perl itself. 
#
# $FML: search_max_id.pl,v 1.1 2001/11/20 07:02:57 fukachan Exp $
#

use strict;
use lib qw(../../fml/lib ../../cpan/lib ../../img/lib);

use Benchmark;

use File::Sequence;
my $obj = new File::Sequence;
my $max_id = $ENV{'max_id'};

for my $file (@ARGV) {
    my %db = ();
    my $f  = $file; $f =~ s/\.\w+$//;

    use AnyDBM_File;
    use Fcntl;
    tie %db, 'AnyDBM_File', $f, O_RDWR|O_CREAT, 0644;

    print STDERR "\nsearch with pebot:\n";
    print STDERR "max = ";
    my $t0 = new Benchmark;
    print STDERR $obj->search_max_id( { hash => \%db } );
    my $t1 = new Benchmark;
    my $td = timediff($t1, $t0);
    print STDERR " ", timestr($td), "\n";


    print STDERR "\nfull search:\n";
    print STDERR "max = ";
    my $t0 = new Benchmark;
    print STDERR $obj->search_max_id( { 
	hash => \%db,
	full_search => 1,
    } );
    my $t1 = new Benchmark;
    my $td = timediff($t1, $t0);
    print STDERR " ", timestr($td), "\n";

}

exit 0;