Skip to content

Instantly share code, notes, and snippets.

View lizmat's full-sized avatar
💭
Functioning within parameters

Elizabeth Mattijsen lizmat

💭
Functioning within parameters
View GitHub Profile
$ 6 'use Data::Dump::Tree; use nqp; ddt nqp::backendconfig'
{153} @0
├ ar => ar.Str
├ arflags => rcs.Str
├ arout => .Str
├ as => as.Str
├ asm => .s.Str
├ asmout => -o .Str
├ asmswitch => -S.Str
├ auxclean => @:.Str
$ 6mp 'sub a() { my $a = 42 }; .say for profile( { a for ^10000 } ).my_callees'
Unnamed callee was called 1 time
at -e line 1
from thread #1.
Was jitted and had an On-Stack-Replacement.
Called at 0 microsecs and ran for 5649 microsecs.
Did 12455 allocations (of which 1 (0.01%) was done here).
Unnamed callee was called 10000 times
at -e line 1
Type 'Rakudo::Iterator::IntRange' of REPR 'P6opaque' (56 bytes)
Type 'PseudoStash' of REPR 'P6opaque' (56 bytes)
Type 'MoarVM::StringHeap' of REPR 'P6opaque' (56 bytes)
Type 'QAST::SVal' of REPR 'P6opaque' (72 bytes)
Type 'VMString' of REPR 'MVMString' (48 bytes)
Type 'ContainerDescriptor::Untyped' of REPR 'P6opaque' (64 bytes)
Type 'MAST::Lexical' of REPR 'P6opaque' (48 bytes)
Type 'MoarVM::BytecodeWriter' of REPR 'P6opaque' (104 bytes)
Type 'Array::ArrayReificationTarget' of REPR 'P6opaque' (48 bytes)
Type 'Rakudo::Iterator::ReifiedArrayIterator' of REPR 'P6opaque' (56 bytes)
use nqp;
# Process a given set of feed operations from a given source and a list of
# Callables to execute. Returns a Seq to be used to storing in the pointy
# end of the feeds.
sub PROCESS-FEED($source, @stages --> Seq:D) {
my class Pipeline is repr('ConcBlockingQueue') {}
# Process a stage with given code for given iterator
my class Process does Iterator {
@lizmat
lizmat / gist:787a6ddb31d51cc67d0c00f3403de78c
Last active May 21, 2019 21:19
fast as you can parallel feed
use nqp;
# Process a given set of feed operations from a given source and a list of
# Callables to execute. Returns a Seq to be used to storing in the pointy
# end of the feeds.
sub PROCESS-FEED($source, @stages --> Seq:D) {
my class Pipeline is repr('ConcBlockingQueue') {}
# Process a stage with given code for given iterator
my class Process does Iterator {
@lizmat
lizmat / gist:8652e4a403fffe64e84b392b31cc6ad4
Created May 21, 2019 16:28
parallel feed implementation
use nqp;
sub PROCESS-FEED($source, @stages --> Seq:D) {
my class Pipeline is repr('ConcBlockingQueue') {}
# process a stage with given code for given iterator
my class Process does Iterator {
has &.code;
has $.iterator;
@lizmat
lizmat / gist:69faa8cb0f2d4972f17561b21bace743
Created May 21, 2019 12:54
Implementation of feed logic
use nqp;
sub PROCESS-FEED($source, @stages --> Seq:D) {
# process a stage with given code for given iterator
my class Process does Iterator {
has &.code;
has $.iterator;
has $.is-lazy;
my $then;
my %h = ^1000;
for ^5 {
$then = now;
for ^5000 { my $a := %h.max(*.value) }
say now - $then;
}
$ 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 December 16, 2018 19:29
slightly smaller, better readable?
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;