Skip to content

Instantly share code, notes, and snippets.

View yko's full-sized avatar

Yaroslav Korshak yko

  • Neno.co
  • Amsterdam, The Netherlands
View GitHub Profile
# Copyright (C) 2008-2010, Sebastian Riedel.
package Lighter::Controller;
use strict;
use warnings;
use base 'Mojo::Base';
use Mojo::ByteStream;
@yko
yko / xx
Created June 21, 2010 14:33
1,3c1
< # Copyright (C) 2008-2010, Sebastian Riedel.
<
< package Mojolicious;
---
> package Lighter;
8c6
< use base 'Mojo';
---
> use base 'Mojo::Base';
1,3c1
< # Copyright (C) 2008-2010, Sebastian Riedel.
<
< package Mojolicious;
---
> package Lighter;
8c6
< use base 'Mojo';
---
> use base 'Mojo::Base';
diff --git a/lib/Mojo/Base.pm b/lib/Mojo/Base.pm
index 47302aa..d0cb014 100644
--- a/lib/Mojo/Base.pm
+++ b/lib/Mojo/Base.pm
@@ -8,6 +8,8 @@ use warnings;
# No imports because we get subclassed, a lot!
require Carp;
+use constant DEBUG => $ENV{MOJO_BASE_DEBUG} ? 1 : 0;
+
#!/usr/bin/perl
package test;
use strict;
use warnings;
sub new { bless {}, shift }
package main;
use strict;
Benchmark: timing 100000 iterations of Eval, Normal...
Eval: 7 wallclock secs ( 6.53 usr + 0.29 sys = 6.82 CPU) @ 14662.76/s (n=100000)
Normal: 2 wallclock secs ( 1.27 usr + 0.11 sys = 1.38 CPU) @ 72463.77/s (n=100000)
Benchmark: timing 10000000 iterations of Eval, Normal...
Eval: 22 wallclock secs (21.30 usr + 0.00 sys = 21.30 CPU) @ 469483.57/s (n=10000000)
Normal: 22 wallclock secs (21.67 usr + 0.00 sys = 21.67 CPU) @ 461467.47/s (n=10000000)
Rate Eval Normal
Eval 16835/s -- -82%
Normal 93458/s 455% --
Rate Normal Eval
Normal 581395/s -- -12%
Eval 662691/s 14% --
#!/usr/bin/env perl
# Copyright (C) 2008-2010, Sebastian Riedel.
use strict;
use warnings;
use utf8;
# Disable epoll, kqueue and IPv6
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Test::More;
plan tests => 4;
use Mojo::Client;
use App;
my $fake_app = App->new;
my $config = $fake_app->plugin(json_config);