| 1 | package Bencher::Scenario::INIParsingModules; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use 5.010001; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | ▶ | use File::ShareDir::Tarball qw(dist_dir); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 1 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |||||||||
| 10 | 1 | our $DATE = '2024-02-19'; # DATE | |||||||||
| 11 | 1 | our $DIST = 'Bencher-Scenario-INIParsingModules'; # DIST | |||||||||
| 12 | 1 | our $VERSION = '0.003'; # VERSION | |||||||||
| 13 | |||||||||||
| 14 | 1 | our $scenario = { | |||||||||
| 15 | summary => 'Benchmark INI parsing modules', | ||||||||||
| 16 | modules => { | ||||||||||
| 17 | # minimum versions | ||||||||||
| 18 | #'Foo' => {version=>'0.31'}, | ||||||||||
| 19 | }, | ||||||||||
| 20 | participants => [ | ||||||||||
| 21 | { | ||||||||||
| 22 | module => 'Config::IOD::INI::Reader', | ||||||||||
| 23 | code_template => 'state $iod = Config::IOD::INI::Reader->new; $iod->read_file(<filename>)', | ||||||||||
| 24 | }, | ||||||||||
| 25 | { | ||||||||||
| 26 | module => 'Config::INI::Reader', | ||||||||||
| 27 | code_template => 'Config::INI::Reader->read_file(<filename>)', | ||||||||||
| 28 | }, | ||||||||||
| 29 | { | ||||||||||
| 30 | module => 'Config::IniFiles', | ||||||||||
| 31 | code_template => 'Config::IniFiles->new(-file => <filename>)', | ||||||||||
| 32 | }, | ||||||||||
| 33 | { | ||||||||||
| 34 | module => 'Config::Simple::Conf', | ||||||||||
| 35 | code_template => 'Config::Simple::Conf->new(<filename>)', | ||||||||||
| 36 | }, | ||||||||||
| 37 | { | ||||||||||
| 38 | module => 'Config::INI::Tiny', | ||||||||||
| 39 | code_template => 'state $cfg = Config::INI::Tiny->new; $cfg->to_hash(do { local $/; open my $fh, "<", <filename> or die; scalar readline($fh) } )', | ||||||||||
| 40 | }, | ||||||||||
| 41 | { | ||||||||||
| 42 | module => 'Config::Tiny', | ||||||||||
| 43 | code_template => 'Config::Tiny->read(<filename>)', | ||||||||||
| 44 | }, | ||||||||||
| 45 | ], | ||||||||||
| 46 | |||||||||||
| 47 | datasets => [ | ||||||||||
| 48 | ], | ||||||||||
| 49 | }; | ||||||||||
| 50 | |||||||||||
| 51 | 1 | ▶ | my $dir = dist_dir('INI-Examples') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | or die "Can't find share dir for INI-Examples"; | ||||||||||
| 53 | 1 | for my $filename (glob "$dir/examples/*bench*.ini") { | |||||||||
| 54 | 1 | my $basename = $filename; $basename =~ s!.+/!!; | |||||||||
| 55 | 1 | push @{ $scenario->{datasets} }, { | |||||||||
| 56 | name => $basename, | ||||||||||
| 57 | args => {filename => $filename}, | ||||||||||
| 58 | }; | ||||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 1 | 1; | |||||||||
| 62 | # ABSTRACT: Benchmark INI parsing modules | ||||||||||
| 63 | |||||||||||
| 64 | __END__ | ||||||||||