Skip to content

Instantly share code, notes, and snippets.

@bokutin
Created February 21, 2013 12:23
Show Gist options
  • Save bokutin/5004392 to your computer and use it in GitHub Desktop.
Save bokutin/5004392 to your computer and use it in GitHub Desktop.
---
./config.pl: |
use Data::Dumper;
+{
name => "MojoApp",
};
mojo_app/lib/MojoApp.pm: |
package MojoApp;
use Mojo::Base 'Mojolicious';
sub startup {
my $self = shift;
$self->plugin('Config');
}
1;
mojo_app/mojo_app.conf: |
+{
name => "MojoApp",
};
# vim: set sw=2 ft=perl :
script/bench.pl: |
#!/usr/bin/env perl
use Modern::Perl;
use IO::All;
use YAML;
my %file;
$file{"$_"} = $_->all for io("./")->All_Files;
my %bench;
$bench{"$_"} = `time -lp $_ 2>&1` for grep { /try.*pl$/ } io("./")->All_Files;
local $YAML::Indent = 4;
say Dump \%file, \%bench;
script/try_config_jfdi.pl: |
#!/usr/bin/env perl
use rlib "../mojo_app/lib";
use Config::JFDI;
my $config = Config::JFDI->new(name => "config", path => ".")->get;
die unless $config->{name};
script/try_config_mojo.pl: |
#!/usr/bin/env perl
use rlib "../mojo_app/lib";
use MojoApp;
my $config = MojoApp->new->config;
die unless $config->{name};
script/try_config_plain.pl: |
#!/usr/bin/env perl
use rlib "../mojo_app/lib";
my $config = do "config.pl";
die unless $config->{name};
script/try_config_zomg.pl: |
#!/usr/bin/env perl
use rlib "../mojo_app/lib";
use Config::ZOMG;
my $config = Config::ZOMG->new(name => "config", path => ".")->load;
die unless $config->{name};
---
script/try_config_jfdi.pl: |
real 0.34
user 0.31
sys 0.02
22056960 maximum resident set size
0 average shared memory size
0 average unshared data size
0 average unshared stack size
5562 page reclaims
0 page faults
0 swaps
0 block input operations
0 block output operations
0 messages sent
0 messages received
0 signals received
0 voluntary context switches
41 involuntary context switches
script/try_config_mojo.pl: |
[Thu Feb 21 21:17:44 2013] [debug] Reading config file "/Users/bokutin/repos/bench-hypnotoad-twiggy/mojo_app/mojo_app.conf".
real 0.32
user 0.29
sys 0.02
25018368 maximum resident set size
0 average shared memory size
0 average unshared data size
0 average unshared stack size
6284 page reclaims
0 page faults
0 swaps
0 block input operations
0 block output operations
0 messages sent
0 messages received
0 signals received
0 voluntary context switches
31 involuntary context switches
script/try_config_plain.pl: |
real 0.04
user 0.03
sys 0.00
5062656 maximum resident set size
0 average shared memory size
0 average unshared data size
0 average unshared stack size
1407 page reclaims
0 page faults
0 swaps
0 block input operations
0 block output operations
0 messages sent
0 messages received
0 signals received
0 voluntary context switches
2 involuntary context switches
script/try_config_zomg.pl: |
real 0.07
user 0.06
sys 0.00
7680000 maximum resident set size
0 average shared memory size
0 average unshared data size
0 average unshared stack size
2050 page reclaims
0 page faults
0 swaps
0 block input operations
0 block output operations
0 messages sent
0 messages received
0 signals received
0 voluntary context switches
4 involuntary context switches
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment