| 1 | package Bencher::Scenario::Log::ger::Overhead; | ||
| 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::Temp qw(tempfile); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 1 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |
| 10 | 1 | our $DATE = '2024-05-12'; # DATE | |
| 11 | 1 | our $DIST = 'Bencher-ScenarioBundle-Log-ger'; # DIST | |
| 12 | 1 | our $VERSION = '0.020'; # VERSION | |
| 13 | |||
| 14 | 1 | my ($fh, $fname) = tempfile(); | |
| 15 | |||
| 16 | 1 | our $scenario = { | |
| 17 | summary => 'Measure startup overhead of various codes', | ||
| 18 | modules => { | ||
| 19 | 'Log::Any' => {}, | ||
| 20 | 'Log::ger' => {version=>'0.019'}, | ||
| 21 | 'Log::ger::App' => {version=>'0.002'}, | ||
| 22 | 'Log::ger::Output' => {version=>'0.005'}, | ||
| 23 | 'Log::ger::Layout::Pattern' => {version=>'0'}, | ||
| 24 | 'Log::Contextual' => {version=>'0'}, | ||
| 25 | 'Log::Dispatch' => {version=>'0'}, | ||
| 26 | 'Log::Dispatch::Null' => {version=>'0'}, | ||
| 27 | 'Log::Log4perl' => {version=>'0'}, | ||
| 28 | 'Log::Log4perl::Tiny' => {version=>'0'}, | ||
| 29 | 'Log::Dispatchouli' => {version=>'0'}, | ||
| 30 | 'Mojo::Log' => {version=>'0'}, | ||
| 31 | 'XLog' => {}, | ||
| 32 | }, | ||
| 33 | code_startup => 1, | ||
| 34 | participants => [ | ||
| 35 | # a benchmark for Log::ger: strict/warnings | ||
| 36 | {code_template=>'use strict;'}, | ||
| 37 | {code_template=>'use warnings;'}, | ||
| 38 | {code_template=>'use strict; use warnings;'}, | ||
| 39 | |||
| 40 | {code_template=>'use Log::ger ();'}, | ||
| 41 | {code_template=>'use Log::ger;'}, | ||
| 42 | {code_template=>'use Log::ger; Log::ger->get_logger;'}, | ||
| 43 | {code_template=>'use Log::ger::App;'}, | ||
| 44 | {code_template=>'use Log::ger::App; use Log::ger;'}, | ||
| 45 | {code_template=>'use Log::ger::Plugin::OptAway; use Log::ger;'}, | ||
| 46 | {code_template=>'use Log::ger::Like::LogAny;'}, | ||
| 47 | {code_template=>'use Log::ger::Like::Log4perl;'}, | ||
| 48 | {code_template=>'use Log::ger::App;'}, | ||
| 49 | |||
| 50 | {code_template=>'use Log::Any;'}, | ||
| 51 | {code_template=>'use Log::Any q($log);'}, | ||
| 52 | |||
| 53 | {code_template=>'use Log::Contextual qw(:log);'}, | ||
| 54 | |||
| 55 | {code_template=>'use Log::Log4perl;'}, | ||
| 56 | |||
| 57 | {code_template=>'use Log::Log4perl::Tiny;'}, | ||
| 58 | |||
| 59 | {code_template=>'use Log::Dispatch;'}, | ||
| 60 | {code_template=>'use Log::Dispatch; my $null = Log::Dispatch->new(outputs=>[ ["Null", min_level=>"warn"] ])', tags=>['output']}, | ||
| 61 | |||
| 62 | {code_template=>'use Log::Dispatchouli;'}, | ||
| 63 | |||
| 64 | {code_template=>'use Log::ger::Output::Screen;', tags=>['output']}, | ||
| 65 | {code_template=>'use Log::ger::Output::Composite;', tags=>['output']}, | ||
| 66 | |||
| 67 | {code_template=>'use Mojo::Log;'}, | ||
| 68 | {code_template=>'use Mojo::Log; my $log=Mojo::Log->new(level=>"warn")'}, | ||
| 69 | |||
| 70 | {code_template=>'use XLog;'}, | ||
| 71 | |||
| 72 | # TODO: Lg + Composite (2 outputs) | ||
| 73 | # TODO: Lg + Composite (2 outputs + pattern layouts) | ||
| 74 | # TODO: Log::Any + Screen | ||
| 75 | # TODO: Log::Log4perl + easy_init | ||
| 76 | ], | ||
| 77 | }; | ||
| 78 | |||
| 79 | 1 | 1; | |
| 80 | # ABSTRACT: Measure startup overhead of various codes | ||
| 81 | |||
| 82 | __END__ | ||