Perl 6 - the future is here, just unevenly distributed

IRC log for #moarvm, 2017-02-12

| Channels | #moarvm index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:34 pyrimidine joined #moarvm
00:53 samcv well i fixed my bug with the bitfield row code for UCD-gen.p6, had an off by one, and was looking up the bitfield row index at the wrong point in the process, so moved that into the get_bitfield_offset function, and only calls that when the letter isn't part of a range
01:55 FiveBroDeepBook joined #moarvm
01:55 FiveBroDeepBook left #moarvm
02:36 pyrimidine joined #moarvm
02:37 colomon_ joined #moarvm
02:39 colomon joined #moarvm
02:46 colomon joined #moarvm
02:57 pyrimidine joined #moarvm
03:17 geekosaur joined #moarvm
04:35 pyrimidine joined #moarvm
06:27 MasterDuke .tell jnthn well, after some distractions, i'm currently trying to get Parameter.named_names to be useful. i can't `for @!named_names { }`, which isn't surprising, but i also can't `my $i := nqp::iterator(@!named_names); while $iter { nqp::shift_s($iter)) }`, which is
06:27 yoleaux2 MasterDuke: I'll pass your message to jnthn.
06:28 MasterDuke .tell jnthn i'm probably just not thinking because it's late, with that i'm off...
06:28 yoleaux2 MasterDuke: I'll pass your message to jnthn.
06:48 FiveBroDeepBook joined #moarvm
06:48 FiveBroDeepBook left #moarvm
09:58 pyrimidine joined #moarvm
11:19 ggoebel joined #moarvm
12:03 patrickz joined #moarvm
12:09 jnthn .tell MasterDuke Just use nqp::elems and loop over indices
12:09 yoleaux2 jnthn: I'll pass your message to MasterDuke.
12:09 yoleaux2 06:27Z <MasterDuke> jnthn: well, after some distractions, i'm currently trying to get Parameter.named_names to be useful. i can't `for @!named_names { }`, which isn't surprising, but i also can't `my $i := nqp::iterator(@!named_names); while $iter { nqp::shift_s($iter)) }`, which is
12:10 yoleaux2 06:28Z <MasterDuke> jnthn: i'm probably just not thinking because it's late, with that i'm off...
12:32 MasterDuke jnthn: hm, i see in my vim undo history that i had tried .elems, which gives `Cannot find method 'elems': no method cache and no .^find_method`, and nqp::elems(), which gives `This type (Array) does not support elems`
12:32 yoleaux2 12:10Z <jnthn> MasterDuke: Just use nqp::elems and loop over indices
12:33 MasterDuke but completely forgot to mention that
12:36 MasterDuke hm, wait, may be something else
12:40 timotimo if you have an Array, you need to get at its $!storage
12:41 FiveBroDeepBook joined #moarvm
12:41 FiveBroDeepBook left #moarvm
12:42 MasterDuke turns out i was trying to stick an Array in $!refied. converting it into an nqp::list() worked
12:43 timotimo oh, hehe.
12:43 timotimo yeah, $!reified is for low-level lists, usually we use ReificationTarget, which is a very thin wrapper around what nqp::list also is
12:46 MasterDuke initially i tried sticking my nqp::list_s in $!reified, but then some Rakudo::Iterator complained it needed to use atpos_s
12:48 timotimo right
12:49 timotimo that won't fly unless all parts agree on the list_s-ness, though ReificationTarget is a class which means you could derive from it and use _s everywhere for it maybe
12:50 MasterDuke i'm just creating a list and sticking all the elements of the list_s in it
12:50 timotimo i wonder, can nqp::splice do that for you?
12:50 timotimo or does it complain because nqp::list and nqp::list_s don't match up and it'd have to box?
12:54 MasterDuke m: use nqp; my $a := nqp::list_s("ab", "cd"); my $b := nqp::list(); nqp::splice($b, $a, 0, nqp::elems($a))
12:54 jnthn Probably, yeah
12:54 camelia rakudo-moar 266f34: OUTPUT«MVMArray: atpos expected string register␤  in block <unit> at <tmp> line 1␤␤»
12:54 jnthn You'd have to write a loop
12:54 timotimo OK :(
12:55 jnthn Which shouldn't be so hard? :)
12:55 timotimo let's build a combination of splice for every combination of _o, _i, _n, _s :)
12:55 timotimo but but but performance ;)
12:55 timotimo code size!
12:55 MasterDuke jnthn: you'd be surprised what i couldn't get right last night
13:08 pyrimidi_ joined #moarvm
15:00 MasterDuke now spectests clean, that took *way* longer than it should have
15:01 timotimo seems like your changes to the code made rakudo a bit slower? :P
15:02 timotimo oh, you don't mean it's been doing a spec test run since you last rote
15:02 timotimo wrote*
15:03 MasterDuke ha, no. it took me way longer than it should have to get the changes correct
15:04 timotimo i know that feeling all too well
15:06 MasterDuke is there any speed difference between `while nqp::iterator { nqp::shift }` and `for nqp::elems { nqp::atpos }`?
15:07 timotimo good question
15:12 MasterDuke m: use nqp; my $n := nqp::list_i(2, 4, 6, 8, 10, 12, 14, 16, 18, 20); my int $s = 0; for ^100_000 { my $i := nqp::iterator($n); while $i { $s += nqp::shift_i($i) }; }; say $s; say now - INIT now
15:12 camelia rakudo-moar 266f34: OUTPUT«11000000␤0.38052691␤»
15:13 MasterDuke m: use nqp; my $n := nqp::list_i(2, 4, 6, 8, 10, 12, 14, 16, 18, 20); my int $s = 0; for ^100_000 { my int $i = nqp::elems($n); for ^$i { $s += nqp::atpos_i($n, $i) }; }; say $s; say now - INIT now
15:13 camelia rakudo-moar 266f34: OUTPUT«0␤3.322353␤»
15:13 MasterDuke wow, wasn't expecting that big of a difference
15:15 MasterDuke `for nqp::elems { nqp::atpos }` 10x slower
15:15 timotimo wow
15:15 timotimo well, the iterator has something basically better than native int for going through the array
15:16 timotimo interestingly, the second one gives 0
15:16 timotimo what's that all about?
15:17 MasterDuke oh hey, odd
15:17 timotimo oh
15:17 timotimo you're using $i there
15:17 timotimo should be using $_
15:17 timotimo so you're always accessing out of bounds?
15:17 MasterDuke m: use nqp; my $n := nqp::list_i(2, 4, 6, 8, 10, 12, 14, 16, 18, 20); my int $s = 0; for ^100_000 { my int $i = nqp::elems($n); for ^$i { $s += nqp::atpos_i($n, $_) }; }; say $s; say now - INIT now
15:17 camelia rakudo-moar 266f34: OUTPUT«11000000␤3.36412964␤»
15:18 MasterDuke still slow
15:18 moritz .oO( it's easy to give the wrong answer in O(1) )
15:18 timotimo i guess that means our iterators are cool
15:18 timotimo moritz: unless you want to always give the wrong answer! :)
15:18 timotimo in which case you'll have to be careful not to accidentally give the right answer
15:20 pyrimidine joined #moarvm
15:21 * MasterDuke is pondering investigating all uses of nqp::elems in NQP and Rakudo to see if they're being used for looping and could be replaced with iteratoring (which by the way sounds awesome, even if not correct)
15:21 timotimo might be worth a shot
15:22 MasterDuke 169 of them in NQP, 675 in Rakudo
15:36 MasterDuke interesting, in nqp, elems+atpos is just slightly faster
15:39 MasterDuke nqp: my num $t := nqp::time_n(); my $n := nqp::list_i(2, 4, 6, 8, 10, 12, 14, 16, 18, 20); my int $s := 0; my int $c := 0; while ++$c < 5_000_000 { my $i := nqp::iterator($n); while $i { $s := $s + nqp::shift_i($i) }; }; say($s); say(nqp::time_n() - $t)
15:39 camelia nqp-moarvm: OUTPUT«549999890␤2.32571053504944␤»
15:39 MasterDuke nqp: my num $t := nqp::time_n(); my $n := nqp::list_i(2, 4, 6, 8, 10, 12, 14, 16, 18, 20); my int $s := 0; my int $c := 0; while ++$c < 5_000_000 { my int $i := nqp::elems($n); while --$i >= 0 { $s := $s + nqp::atpos_i($n, $i) }; }; say($s); say(nqp::time_n() - $t)
15:39 camelia nqp-moarvm: OUTPUT«549999890␤2.22173023223877␤»
15:39 moritz please don't rely on camelia for benchmarks
15:39 moritz it runs in a VM on a multi-user system
15:40 moritz and has other features (like background compilation/updates) that make it *very* unsuitable for benchmarks
15:40 MasterDuke moritz: just demoing for the channel, i'm running a little bit more rigorous tests on my machine
15:40 moritz MasterDuke: ok, good
15:53 colomon_ joined #moarvm
15:58 pyrimidi_ joined #moarvm
16:02 camelia joined #moarvm
16:32 Geth ¦ MoarVM: timo++ created pull request #536: vmhealth op that spits out some stats
16:32 Geth ¦ MoarVM: review: https://github.com/MoarVM/MoarVM/pull/536
16:33 timotimo ^- opened for discussion
16:33 timotimo and review and such
17:34 geekosaur joined #moarvm
17:59 nine joined #moarvm
18:01 camelia joined #moarvm
18:02 geekosaur joined #moarvm
18:11 colomon joined #moarvm
18:16 colomon joined #moarvm
18:21 colomon joined #moarvm
18:26 colomon joined #moarvm
19:12 ilmari[m] joined #moarvm
19:29 agentzh joined #moarvm
19:32 colomon_ joined #moarvm
20:16 pyrimidine joined #moarvm
20:29 agentzh joined #moarvm
21:40 colomon_ joined #moarvm
22:14 lucasb joined #moarvm
22:27 agentzh joined #moarvm
23:09 samcv what does anybody think of this brainstormed idea https://gist.github.com/samcv/fca0ba6e76dba9f8efa860d50ad124ca
23:09 samcv for storing the bitfield indexes. right now in UCD-gen.p6 i make a huge if else chain
23:10 samcv but this is something i came up with today
23:13 samcv and we could use binary search or something more complex to know where in the sorted_table to look first
23:13 samcv without having to go through a huge if else chain
23:13 samcv not sure how big it would end up being though
23:17 samcv looks like would take 16kb currently

| Channels | #moarvm index | Today | | Search | Google Search | Plain-Text | summary