Skip to content

Instantly share code, notes, and snippets.

View exodist's full-sized avatar

Chad Granum exodist

View GitHub Profile
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 = $@;
@exodist
exodist / benchmarks
Last active August 29, 2015 14:22
Test::Stream VS Test::More
Test-Simple version: 1.001014
perl ../Test-Stream/profiling/ok_builder.t 45.36s user 3.91s system 91% cpu 53.955 total
Test-Simple version: 1.001014
perl ../Test-Stream/profiling/ok_builder.t 44.81s user 3.84s system 91% cpu 53.282 total
Test-Simple version: 1.001014
perl ../Test-Stream/profiling/ok_builder.t 46.35s user 3.66s system 91% cpu 54.695 total
-------------------
perl -E 'my $x = {}; my $y = $x; say Internals::SvREFCNT(%{$x})'
2
perl -T -E 'my $x = {}; my $y = $x; say Internals::SvREFCNT(%$x)'
2
perl -T -E 'my $x = {}; my $y = $x; say Internals::SvREFCNT(%{$x})'
3
sub is($$;$) {
my $pass = ... existing implementation ...;
if (!$pass) {
my $two_nums = ...;
my $res = $two_nums && $got == $want;
diag "...you did it wrong..." if $res;
}
return $pass;
}
use Data::Dumper;
my $stash = \%{"FAKE\::"};
print Dumper([keys %$stash]);
local *FAKE::xxx = sub { 'xxx' };
print Dumper([keys %$stash]);
use strict;
use warnings;
sub do_it {
my $x = 1;
$x++ while caller($x);
print "Doin' it (Depth: $x)\n";
eval "END { do_it; exit }; 1 "|| die $@;
}
$ tracepath -m200 bad.horse
[...]
8: t00.nycmc1.ny.us.sn11.net 101.570ms
9: bad.horse 102.077ms asymm 12
10: bad.horse 106.139ms asymm 12
11: bad.horse 108.322ms asymm 12
12: bad.horse 116.249ms
13: he.rides.across.the.nation 121.157ms
14: the.thoroughbred.of.sin 126.335ms
15: he.got.the.application 131.509ms
commit 9f39a706c009646a5876cf205c8b6c13b7445e28
Author: Chad Granum <[email protected]>
Date: Sat Sep 26 22:40:04 2015 -0700
Capabilities: detect bad 5.10.0 threads
diff --git a/lib/Test/Stream/Capabilities.pm b/lib/Test/Stream/Capabilities.pm
index 4e65ff9..27b8cae 100644
--- a/lib/Test/Stream/Capabilities.pm
+++ b/lib/Test/Stream/Capabilities.pm
use Test::Stream -V1, Compare => '*';
is(
{ a => 'foo', b => 'bar' },
hash {
field a => match qr/fox/;
field b => match qr/box/;
},
"Sample"
);