Skip to content

Instantly share code, notes, and snippets.

View exodist's full-sized avatar

Chad Granum exodist

View GitHub Profile
@exodist
exodist / gist:994205516e2d9f3a5e3f
Last active August 29, 2015 14:19
perl-blead timings
Test::Stream:
Elapsed: 976 sec
u=8.72 s=2.22 cu=606.88 cs=52.03 scripts=2347 tests=711443
Legacy:
Elapsed: 986 sec
u=8.36 s=2.47 cu=551.54 cs=46.54 scripts=2296 tests=720367
exodist@Work $ git status (blead)[~/projects/perl]
On branch blead
Your branch is ahead of 'origin/blead' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
my $iapp = Plack::App::WrapCGI->new(script => "$path/$cgi")->to_app;
my $app = sub {
my $env = shift;
return [
'404',
['Content-Type' => 'text/plain'],
["404 error\n"]
] unless -e $self->path . $env->{PATH_INFO};
$ perl -V [~/MongoDB-v0.708.0.0]
Summary of my perl5 (revision 5 version 20 subversion 2) configuration:
Platform:
osname=linux, osvers=3.13.0-44-generic, archname=x86_64-linux-thread-multi
uname='linux work 3.13.0-44-generic #73-ubuntu smp tue dec 16 00:22:43 utc 2014 x86_64 x86_64 x86_64 gnulinux '
config_args='-de -Dprefix=/home/exodist/perl5/perlbrew/perls/mongo -Dusethreads -Aeval:scriptdir=/home/exodist/perl5/perlbrew/perls/mongo/bin'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
use64bitint=define, use64bitall=define, uselongdouble=undef
@exodist
exodist / gist:ef08a3c406d98c1bb618
Last active August 29, 2015 14:20
smallest mongo+test-simple script
use strict;
use warnings;
use Test::More 'no_plan';
use MongoDB::Timestamp; # needed if db is being run as master
use MongoDB;
use lib "t/lib";
use MongoDBTest qw/build_client get_test_db/;
@exodist
exodist / gist:93efb79fc227ec799687
Created May 1, 2015 18:33
mongodb error point of problem in Test-Simple
#https://github.com/Test-More/test-more/blob/stream/master/lib/Test/Stream/Context.pm#L263
# expanded:
# This still demonstrates problem:
sub snapshot {
my ($self, $type, $copy, $new);
$self = shift;
$type = blessed($self);
$copy = {%$self};
$new = bless $copy, $type;
unshift @INC => sub {
my ($us, $file) = @_;
return unless $REDIRECT{$file};
my $rewrite = $file;
$rewrite =~ s/\.pm$/_stream.pm/;
require $rewrite;
$INC{$file} = $INC{$rewrite};
@exodist
exodist / Perl -V
Created May 12, 2015 18:04
fast perl
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
Platform:
osname=linux, osvers=2.6.32-5-amd64, archname=x86_64-linux-gnu-thread-multi
uname='linux barber 2.6.32-5-amd64 #1 smp tue jun 14 09:42:28 utc 2011 x86_64 gnulinux '
config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=x86_64-linux-gnu -Dprefix=/usr -Dprivlib=/usr/share/perl/5.10 -Darchlib=/usr/lib/perl/5.10 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.10.0 -Dsitearch=/usr/local/lib/perl/5.10.0 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Ud_ualarm -Uusesfio -Uusenm -DDEBUGGING=-g -Doptimize=-O2 -Duseshrplib -Dlibperl=libperl.so.5.10.0 -Dd_dosuid -des'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usem
4,6c4,6
< osname=linux, osvers=2.6.32.8-grsec-2.1.14-modsign-xeon-64, archname=x86_64-linux
< uname='linux fubar 2.6.32.8-grsec-2.1.14-modsign-xeon-64 #2 smp sat mar 13 00:42:43 pst 2010 x86_64 gnulinux '
< config_args='-Dprefix=/opt/ndn-perl/cgranum -de -Dotherlibdirs=/opt/ndn-perl/shared/lib/ndn_perl -Duse64bitint -Duse64bitall -Accflags=-fPIC -A'eval:scriptdir=/opt/ndn-perl/cgranum/bin''
---
> osname=linux, osvers=3.13.0-52-generic, archname=x86_64-linux
> uname='linux dev-uebernet-spikes2 3.13.0-52-generic #86~precise1-ubuntu smp tue may 5 18:08:21 utc 2015 x86_64 x86_64 x86_64 gnulinux '
> config_args='-Dprefix=/opt/ndn-perl/dev -de -Dotherlibdirs=/opt/ndn-perl/shared/lib/ndn_perl -Duse64bitint -Duse64bitall -Accflags=-fPIC -A'eval:scriptdir=/opt/ndn-perl/dev/bin''
15c15
< ccversion='', gccversion='4.3.2', gccosandvers=''
@exodist
exodist / test.pl
Created May 30, 2015 03:17
This is broken on perls < 5.20
use strict;
use warnings;
sub do_it(&) {
my $sub = shift;
my $finished = 0;
my ($ok, $err);
FOO: {
my $ok = eval { $sub->(); 1 };
$err = $@;