Skip to content

Instantly share code, notes, and snippets.

Elizabeth Mattijsen lizmat

Block or report user

Report or block lizmat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:abf5a897d1e4f629089245be7f8b3666
my $then;
my %h = ^1000;
for ^5 {
$then = now;
for ^5000 { my $a := %h.max(*.value) }
say now - $then;
}
View gist:525c9acaf89bafd188bf64e7d600439e
$ perl Configure.pl --gen-moar=jit-expr-float
Creating tools/build/install-jvm-runner.pl ...
M 3rdparty/dynasm
Previous HEAD position was 987269e... Get readnum working, try for 32-bit num support
Branch jit-expr-float set up to track remote branch jit-expr-float from origin.
Switched to a new branch 'jit-expr-float'
Already up-to-date.
Configuring and building MoarVM ...
@lizmat
lizmat / gist:87ac6d356b4a4677e40d75815b8bd8e1
Created Dec 16, 2018
slightly smaller, better readable?
View gist:87ac6d356b4a4677e40d75815b8bd8e1
for 0..9 -> int $d {
for 0..9 -> int $e {
next if $e == $d;
my int $y = ($d + $e) % 10;
my int $_c1 = ($d + $e) div 10;
for 0..9 -> int $n {
next if $n == $d;
View gist:1af8dee8fc84a75b54e19e91e2a7d76d
Configuring E/ET/ETHER/Moose-2.2011.tar.gz with Makefile.PL
In file included from HASCOMPILERElf4/TESTbL5Q.c:3:
In file included from /usr/local/lib/perl5/5.20.0/darwin-2level/CORE/perl.h:5152:
/usr/local/lib/perl5/5.20.0/darwin-2level/CORE/inline.h:311:9: warning: nonnull
parameter 'pv' will evaluate to 'true' on first encounter
[-Wpointer-bool-conversion]
if (pv && len > 1) {
^~ ~~
/usr/local/lib/perl5/5.20.0/darwin-2level/CORE/proto.h:1791:4: note: declared
'nonnull' here
View gist:7f82e393e3db53c6b570f3d50f629eae
diff --git a/src/Perl6/Actions.nqp b/src/Perl6/Actions.nqp
index 44f8b80..b080f99 100644
--- a/src/Perl6/Actions.nqp
+++ b/src/Perl6/Actions.nqp
@@ -3581,6 +3581,22 @@ class Perl6::Actions is HLL::Actions does STDActions {
elsif $<type_declarator> { make $<type_declarator>.ast }
elsif $<variable_declarator> {
my $past := $<variable_declarator>.ast;
+
+ # got a 'my $*FOO', need to convert back to just a Var
@lizmat
lizmat / gist:4594bf4ae699b1464aa78ad49bb37220
Created Oct 3, 2018
Fastest Perl 6 object creation bench:
View gist:4594bf4ae699b1464aa78ad49bb37220
class Point {
has int $.x;
has int $.y;
method !SET($!x,$!y) { self }
method new(:$x is raw, :$y is raw) { self.CREATE!SET($x,$y) }
}
my $total = 0;
for ^1_000_000 -> int $_ {
my $p := Point.new(x => 2, y => 3);
$total += $p.x + $p.y;
@lizmat
lizmat / gist:0454f034b9336673cea4fb31927ca164
Created Sep 19, 2018
A faster JSON parser, with limited capabilities
View gist:0454f034b9336673cea4fb31927ca164
my $meta = "META6.json".IO.slurp;
my $old = Rakudo::Internals::JSON.new.from-json($meta);
use Test;
use MONKEY;
augment class Rakudo::Internals::JSON {
@lizmat
lizmat / gist:1cc5df073b8e6f1e7de84d05edecf460
Created Sep 4, 2018
Problem building rakudo after bumping NQP to 2018.08-24-gec437ae
View gist:1cc5df073b8e6f1e7de84d05edecf460
$ make install; ls -l CORE.setting.moarvm >> moarvm.sizes
/usr/local/bin/perl tools/build/check-nqp-version.pl /Users/liz/Github/rakudo.moar/install/bin/nqp-m
clang -c -fno-omit-frame-pointer -fno-optimize-sibling-calls -O3 -DNDEBUG -Wno-logical-op-parentheses -D_DARWIN_USE_64_BIT_INODE=1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -O3 -DNDEBUG -Wno-logical-op-parentheses -I/Users/liz/Github/rakudo.moar/install/include/libatomic_ops \
-I/Users/liz/Github/rakudo.moar/install/include/dyncall -I/Users/liz/Github/rakudo.moar/install/include/moar \
-I/Users/liz/Github/rakudo.moar/install/include/sha1 -I/Users/liz/Github/rakudo.moar/install/include/tinymt -I/Users/liz/Github/rakudo.moar/install/include/libtommath \
-I/Users/liz/Github/rakudo.moar/install/include/libuv -I/Users/liz/Github/rakudo.moar/install/include -I3rdparty/libuv/include -I3rdparty/libuv/src -I3rdparty/libatomicops/src -I3rdparty/libtommath -I3rdparty/dyncall/dynload -I3rdparty/dyncall/dyncall -I3rdparty/dyncall/dyncal
@lizmat
lizmat / gist:8fff372998ed43d8d33ec38165bed290
Last active Aug 3, 2018
LDWL solution with bonus, runs in about 8 seconds
View gist:8fff372998ed43d8d33ec38165bed290
unit sub MAIN($show-from is copy = *, $filename = "-");
# Get the words in a hash and an array from longest -> shortest
my @words;
my %words = $filename.IO.lines.map: { @words[.chars].push($_); $_ => True }
@words = @words.reverse.map: { |$_ if $_ } # flatten them out
my $lock = Lock.new; # to serialize pushes to @ldwl and deletes from %words
my @ldwl;
View gist:b05d32486b1d74a4b69fcea13fe4b9d8
# Find the sum of all the primes below two million.
use v6;
my int $max = 2_000_000;
# find all primes up to $max using The Sieve of Erathostenes
my int @a = 0..$max;
@a[1] = 0; # don't include 1
for (2 .. ($max div 2)) -> int $i {
You can’t perform that action at this time.