File: export_bench.pl

package info (click to toggle)
libdata-util-perl 0.67-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 556 kB
  • sloc: perl: 2,958; ansic: 416; makefile: 8
file content (53 lines) | stat: -rw-r--r-- 865 bytes parent folder | download | duplicates (5)
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
#!perl -w

use strict;

use Benchmark qw(:all);

use FindBin qw($Bin);
use lib $Bin, "$Bin/../example/lib";
use Common;

use Data::Util qw(:all);

signeture
	'Data::Util'    => \&install_subroutine,
	'Sub::Exporter' => \&Sub::Exporter::import,
	'Exporter'      => \&Exporter::import,
;

BEGIN{
	package SE;
	use Sub::Exporter -setup => {
		exports => [qw(foo bar baz hoge fuga piyo)],
	};
	$INC{'SE.pm'} = __FILE__;

	package SEL;
	use Sub::Exporter::Lexical
		exports => [qw(foo bar baz hoge fuga piyo)],
	;
	$INC{'SEL.pm'} = __FILE__;

	package E;
	use Exporter qw(import);
	our @EXPORT = qw(foo bar baz hoge fuga piyo);

	$INC{'E.pm'} = __FILE__;
}

cmpthese timethese -1 => {
	'S::Exporter' => sub{
		package A;
		eval q{ use SE; };
	},
	'S::E::Lexical' => sub{
		package B;
		eval q{ use SEL; };
	},
	'Exporter' => sub{
		package C;
		eval q{ use E; };
	},
}