File: get_code_ref_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 (25 lines) | stat: -rw-r--r-- 404 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
#!perl -w

use strict;

use Benchmark qw(:all);

use FindBin qw($Bin);
use lib $Bin;
use Common;

use Data::Util qw(:all);

signeture 'Data::Util' => \&get_code_ref;

my $pkg  = 'Data::Util';
my $name = 'get_code_ref';

cmpthese timethese -1 => {
	get_code_ref => sub{
		my $code = get_code_ref($pkg, $name);
	},
	direct => sub{
		my $code = do{ no strict 'refs'; *{$pkg . '::' . $name}{CODE}; };
	},
};