File: benchmk2.pl

package info (click to toggle)
libbit-vector-perl 7.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,008 kB
  • sloc: perl: 6,703; ansic: 3,654; makefile: 9
file content (67 lines) | stat: -rwxr-xr-x 664 bytes parent folder | download | duplicates (10)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!perl

use Benchmark;
use Bit::Vector::String;

$v = Bit::Vector->new(1024);

$v->Primes();

$s = '';

$b = $v->to_Bin();
$o = $v->to_Oct();
$h = $v->to_Hex();

sub to_Bin
{
    $s = $v->to_Bin();
}

sub to_Oct
{
    $s = $v->to_Oct();
}

sub to_Hex
{
    $s = $v->to_Hex();
}

sub from_Bin
{
    $v->from_Bin($b);
}

sub from_Oct
{
    $v->from_Oct($o);
}

sub from_Hex
{
    $v->from_Hex($h);
}

timethese
(
    10000,
    {
        to_Bin => \&to_Bin,
        to_Oct => \&to_Oct,
        to_Hex => \&to_Hex
    }
);

timethese
(
    10000,
    {
        from_Bin => \&from_Bin,
        from_Oct => \&from_Oct,
        from_Hex => \&from_Hex
    }
);

__END__