Leser: 3
10 Einträge, 1 Seite |
1
2
3
4
5
use Tk;
use Tk::Font;
my $w=MainWindow->new;
my $f=$w->Font;
$f->measure("hallo") for 0..399
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use strict;
use warnings;
use Benchmark qw(:all);
use Tk;
use Tk::Font;
my $w=MainWindow->new;
my $f=$w->Font;
sub time_font_measure {
$f->measure("hallo");
}
timethis( 10, \&time_font_measure);
timethis( 100, \&time_font_measure);
timethis( 400, \&time_font_measure);
timethis( 1000, \&time_font_measure);
timethis(10000, \&time_font_measure);
1
2
3
4
5
timethis 10: 0 wallclock secs ( 0.10 usr + 0.01 sys = 0.11 CPU) @ 90.91/s (n=10)
(warning: too few iterations for a reliable count)
timethis 100: 4 wallclock secs ( 1.05 usr + 0.11 sys = 1.16 CPU) @ 86.21/s (n=100)
timethis 400: 17 wallclock secs ( 4.09 usr + 0.16 sys = 4.25 CPU) @ 94.12/s (n=400)
timethis 1000: 45 wallclock secs (10.64 usr + 0.54 sys = 11.18 CPU) @ 89.45/s (n=1000)
my $f=$w->Font(family => "helvetica", size => 10);
1
2
3
4
5
6
7
8
timethis 10: 0 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
(warning: too few iterations for a reliable count)
timethis 100: 0 wallclock secs ( 0.06 usr + 0.00 sys = 0.06 CPU) @ 1666.67/s (n=100)
(warning: too few iterations for a reliable count)
timethis 400: 1 wallclock secs ( 0.26 usr + 0.01 sys = 0.27 CPU) @ 1481.48/s (n=400)
(warning: too few iterations for a reliable count)
timethis 1000: 2 wallclock secs ( 0.77 usr + 0.03 sys = 0.80 CPU) @ 1250.00/s (n=1000)
timethis 10000: 19 wallclock secs ( 6.81 usr + 0.41 sys = 7.22 CPU) @ 1385.04/s (n=10000)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use Benchmark (':all');
use Tk;
use Tk::Font;
my $mw = MainWindow->new;
my $f1 = $mw->Font(-family => 'helvetica', -size => 10 );
my $f2 = $mw->Font(-family => 'Helvetica', -size => 10 );
timethese( $_, {
'klein' => sub { $f1->measure('hallo'); },
'groß' => sub { $f2->measure('hallo'); },
}) for 400, 1000;
# Ausgabe:
Benchmark: timing 400 iterations of groß, klein...
groß: 28 wallclock secs (19.58 usr + 0.33 sys = 19.91 CPU) @ 20.09/s (n=400)
klein: 14 wallclock secs ( 7.44 usr + 0.21 sys = 7.65 CPU) @ 52.29/s (n=400)
Benchmark: timing 1000 iterations of groß, klein...
groß: 69 wallclock secs (48.47 usr + 0.65 sys = 49.12 CPU) @ 20.36/s (n=1000)
klein: 39 wallclock secs (18.70 usr + 0.49 sys = 19.19 CPU) @ 52.11/s (n=1000)
10 Einträge, 1 Seite |