Skip to content

Instantly share code, notes, and snippets.

-- Original Script by Gunty found on http://tasvideos.org/forum/viewtopic.php?t=3686&postdays=0&postorder=asc&start=20
-- Modifications by @wzl_
console.writeline("Hello")
local hidden = false
-- These tile IDs encode open/cleared tiles where motion is possible
local clear = {}
--for i,v in pairs({0x00, 0x02, 0x04, 0x22, 0x2c, 0x3a}) do clear[v]=true end
for i,v in pairs({0x00}) do clear[v]=true end
-- Window properties
local title = " RNG "
local nr_rows = 16
local nr_columns = 2
local column_width = 16
local text_size = 10;
local targetxpos = 0
local targetypos = 36
local xpos = targetxpos
local ypos = targetypos
C0/0000: 1304 ora ($04,S),Y
C0/0002: D200 cmp ($00)
C0/0004: C05941 cpy #$4159
C0/0007: 3A dec A
C0/0008: 00C0 brk $C0
C0/000A: ADA8D3 lda $D3A8
C0/000D: 1210 ora ($10)
C0/000F: 00C0 brk $C0
C0/0011: 590041 eor $4100,Y
C0/0014: A20F00 ldx #$000F
void export_tile_to_png(tile8 rawtile, const palette pal, const char* filename)
{
FILE *fp = fopen(filename, "wb");
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
png_infop info_ptr = png_create_info_struct(png_ptr);
png_init_io(png_ptr, fp);
png_set_strip_alpha(png_ptr);
png_read_update_info(png_ptr, info_ptr);
png_color* png_palette = (png_color*) png_malloc(png_ptr, pal.size * sizeof(png_color));

Introduction

There is probably a lot to discuss about Test and NativeCall module versionning. Since there are not really part of the language themselves they can be decoupled from the language version, but at the same time they are an important part of the functionnality a perl6 bundle provide you so tt's probably not an easy anwser.

Anyway 6.d is probably the occasion to fix this but also fix or address some issue that exist with the current NativeCall.

My experience with NativeCall is tied to the writing of a binding module (Gumbo), some work on DBIish to introduce more perl6ish method and the writing of GPTrixie, a NativeCall code generator.

I also had some work in the NativeCall.pm module itself (type checking for sub signature and ABI version for lib) and some lowlevel stuff (bool and size_t type)

Average time to transform C data to Perl6 object (xml) in seconds
"rakudo-2016.01.1" => ${:xml(5.3950312896)},
"rakudo-2016.02" => ${:xml(4.92652848062)},
"rakudo-2016.03" => ${:xml(4.7317674055)},
"rakudo-2016.04" => ${:xml(4.9266673772)},
"rakudo-2016.05" => ${:xml(4.71681947714)},
"rakudo-2016.06" => ${:xml(3.9090515814)},
"rakudo-2016.07.1" => ${:xml(2.7266115406)},
"rakudo-2016.08.1" => ${:xml(2.6801272264)},
skarsnik@vps300582:~/perl6/benchmark$ ./rakudo-2017.05/install/bin/perl6 -I p6-linux-proc-statm/lib/ ../testshell.p6 shell
Before shell call : 65.996 kb
html is 258974 chars
After shell call : 66.860 kb
After sleep 5 : 66.860 kb
skarsnik@vps300582:~/perl6/benchmark$ ./rakudo-2017.07/install/bin/perl6 -I p6-linux-proc-statm/lib/ ../testshell.p6 shell
Before shell call : 78.812 kb
html is 258974 chars
After shell call : 106.104 kb
After sleep 5 : 107.192 kb
Benchmarking "normal" usage of Perl6.
Gumbo:
The first test is just parsing a sizeable HTML page (saved localy, around 260Kb, 11 000+ html elements) using the Gumbo module.
The Gumbo module use a C library that parse HTML5 quite quickly then create Perl 6 XML object from the C structures.
The *XML* result is the time for Perl 6 to go through the C object and create these XML objects (html parse is done in ~0.04 sec by C)
The *Dummy* result is a the time to goes through the C tree without creating the object.
MiniGumbo:
To try to track down a bit what is very slow in this. I created a smaller version the Gumbo module and the XML module.
xenial)skarsnik@localhost:~/perl6/rakudo$ uname -a
Linux localhost 3.14.0 #1 SMP PREEMPT Thu Jul 13 11:50:53 PDT 2017 armv7l armv7l armv7l GNU/Linux
t/spec/S17-supply/syntax.t (Wstat: 65280 Tests: 67 Failed: 0)
Non-zero exit status: 255
Parse errors: Bad plan. You planned 73 tests but ran 67.
t/spec/S03-operators/comparison.t (Wstat: 768 Tests: 112 Failed: 3)
Failed tests: 102-104
Non-zero exit status: 3
{
"perl" : "6.*",
"name" : "Gumbo",
"license" : "Artistic-2.0",
"version" : "*",
"description" : "Binding of the gumbo C library, a html parser lib",
"author" : "Sylvain Colinet",
"provides" : {
"Gumbo" : "lib/Gumbo.pm6",
"Gumbo::Parser" : "lib/Gumbo/Parser.pm6",