File: benchmark.pl

package info (click to toggle)
libimage-imlib2-perl 2.03-1.2~deb12u1
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 320 kB
  • sloc: perl: 305; ansic: 112; makefile: 9
file content (43 lines) | stat: -rw-r--r-- 911 bytes parent folder | download | duplicates (7)
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
#!/usr/local/bin/perl

use lib qw(../lib ../blib/lib ../blib/arch);
use Benchmark;
use Image::Imlib2;

my $image = Image::Imlib2->new(100, 100);
$image->set_colour(255, 0, 0, 255);

timethese(-5, {
		'point' => \&point,
		'line' => \&line,
		'rect' => \&rectangle,
		'rect_f' => \&rectangle_fill,
		'ellipse' => \&ellipse,
		'ellipse_f' => \&ellipse_f,
	       });

#$image->save("benchmark.png");

sub point {
  $image->draw_point(rand(100), rand(100));
}

sub line {
  $image->draw_line(rand(100), rand(100), rand(100), rand(100));
}

sub rectangle {
  $image->draw_rectangle(rand(50), rand(50), rand(50), rand(50));
}

sub rectangle_fill {
  $image->fill_rectangle(rand(50), rand(50), rand(50), rand(50));
}

sub ellipse {
  $image->draw_ellipse(rand(50) + 25, rand(50) + 25, rand(24) + 1, rand(24) + 1);
}

sub ellipse_f {
  $image->fill_ellipse(rand(50) + 25, rand(50) + 25, rand(24) + 1, rand(24) + 1);
}