Blame internal/benchmarks/dm5dm6_ex3
|
Packit |
95306a |
#!/usr/bin/perl
|
|
Packit |
95306a |
|
|
Packit |
95306a |
# Usage: dm5dm6 VERS FILE
|
|
Packit |
95306a |
# VERS = 5, 6, 6o
|
|
Packit |
95306a |
# FILE = file containing a list of dates
|
|
Packit |
95306a |
|
|
Packit |
95306a |
use warnings;
|
|
Packit |
95306a |
use strict;
|
|
Packit |
95306a |
|
|
Packit |
95306a |
use Time::HiRes qw / gettimeofday tv_interval /;
|
|
Packit |
95306a |
|
|
Packit |
95306a |
my ($vers,$file) = @ARGV;
|
|
Packit |
95306a |
|
|
Packit |
95306a |
my @dates = `cat $file`;
|
|
Packit |
95306a |
chomp(@dates);
|
|
Packit |
95306a |
|
|
Packit |
95306a |
my $obj;
|
|
Packit |
95306a |
if ($vers eq '5') {
|
|
Packit |
95306a |
require Date::Manip::DM5;
|
|
Packit |
95306a |
Date::Manip::DM5->import(qw(ParseDate));
|
|
Packit |
95306a |
} elsif ($vers eq '6') {
|
|
Packit |
95306a |
require Date::Manip::DM6;
|
|
Packit |
95306a |
Date::Manip::DM6->import(qw(ParseDate));
|
|
Packit |
95306a |
} elsif ($vers eq '6o') {
|
|
Packit |
95306a |
require Date::Manip::Date;
|
|
Packit |
95306a |
$obj = new Date::Manip::Date;
|
|
Packit |
95306a |
} else {
|
|
Packit |
95306a |
die "ERROR: invalid version\n";
|
|
Packit |
95306a |
}
|
|
Packit |
95306a |
|
|
Packit |
95306a |
my $t0 = [gettimeofday()];
|
|
Packit |
95306a |
|
|
Packit |
95306a |
if ($vers eq '5' || $vers eq '6') {
|
|
Packit |
95306a |
foreach my $date (@dates) {
|
|
Packit |
95306a |
ParseDate($date);
|
|
Packit |
95306a |
}
|
|
Packit |
95306a |
} elsif ($vers eq '6o') {
|
|
Packit |
95306a |
foreach my $date (@dates) {
|
|
Packit |
95306a |
$obj->parse($date);
|
|
Packit |
95306a |
}
|
|
Packit |
95306a |
}
|
|
Packit |
95306a |
|
|
Packit |
95306a |
my $t1 = [gettimeofday()];
|
|
Packit |
95306a |
my $et = tv_interval($t0, $t1)*1000;
|
|
Packit |
95306a |
|
|
Packit |
95306a |
printf(STDOUT "Elapsed: %6.3f\n",$et);
|
|
Packit |
95306a |
|
|
Packit |
95306a |
# 5 6 6o
|
|
Packit |
95306a |
# dateset3.txt 857.250 2246.340 2090.676
|
|
Packit |
95306a |
# _notz 683.084 462.898 431.781
|