Welcome to the main channel on the development of MoarVM, a virtual machine for NQP and Rakudo (moarvm.org). This channel is being logged for historical purposes.
Set by lizmat on 24 May 2021.
00:07 reportable6 left 01:09 reportable6 joined 02:09 evalable6 left, linkable6 left 03:11 evalable6 joined 04:24 evalable6 left 05:12 linkable6 joined 06:07 reportable6 left 06:10 reportable6 joined 06:27 evalable6 joined 08:47 linkable6 left, evalable6 left 08:48 evalable6 joined, linkable6 joined
patrickb good * 09:42
m: my int8 $x = 2**7 - 1; say $x; say $x++; say $x 09:43
camelia 127
-129
-128
moon-child m: my int8 $x = 2**7 - 1; say WHAT $x++ 09:44
camelia (Int)
patrickb I'm pondering on this a bit. Without looking at any code, the only way I can imagine the -129 to appear is Raku first doing the increment, and then undoing it again for the return value, but then missing the wrap around. 09:45
moon-child m: my int8 $x = -(2**7); say $x; say $x--; say $x 09:47
camelia -128
128
127
moon-child that is consistent 09:48
patrickb Thinking even more, there are probably other ways that could go wrong and have this outcome. Bugs tend to go wrong in ways we don't anticipate. :-p
10:57 evalable6 left, linkable6 left 11:00 evalable6 joined 12:07 reportable6 left 12:58 linkable6 joined 13:09 reportable6 joined 13:46 kjp left
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2022/02/07/2022-06-basicly/ 13:55
13:59 discord-raku-bot left, discord-raku-bot joined 14:09 Altai-man joined 14:14 linkable6 left, evalable6 left, linkable6 joined, evalable6 joined 14:59 kjp joined
jnthnwrthngtn MasterDuke: There is no .? operator in NQP 15:21
And that bit of code is NQP
15:22 sena_kun_ joined 15:26 Altai-man left 15:30 Merfont left 15:31 Merfont joined 15:59 discord-raku-bot left 16:00 discord-raku-bot joined 16:29 japhb left 16:31 japhb joined 17:54 kjp left, kjp joined 18:07 reportable6 left 18:26 sena_kun_ left
MasterDuke nqp: class A { has $!a; method a() { try self.b; $!a } }; my int $i := 0; my $a := A.new(a => nqp::time); my $b; my $s := nqp::time; while $i++ < 1_000_000 { $b := $a.a }; say(nqp::div_n(nqp::time - $s, 1000000000e0)); say($b) 19:32
camelia 1.925171353
1644262331364191388
MasterDuke nqp: class A { has $!a; method a() { if nqp::can(self, "b") { self.b; }; $!a } }; my int $i := 0; my $a := A.new(a => nqp::time); my $b; my $s := nqp::time; while $i++ < 1_000_000 { $b := $a.a }; say(nqp::div_n(nqp::time - $s, 1000000000e0)); say($b)
camelia 0.007804591
1644262342675866999
MasterDuke it looks like if all we're using the try for is checking the existence of a method, explicitly using nqp::can is quite a bit faster 19:33
lizmat MasterDuke++ # good catch!
19:46 AlexDaniel left, psydroid left
MasterDuke nqp: my $a := $*DOES-NOT-EXISTĀ Ā Ā Ā  # there are a couple of these assignments with a `try` in nqp, but it seems like the `try` isn't necessary (anymore at least) 19:48
camelia ( no output )
[Coke] jvm vs. moar? 19:49
MasterDuke nqp-jvm: my $a := $*DOES-NOT-EXISTĀ Ā Ā Ā  # dunno
camelia sudo: /home/camelia/rakudo-j-inst/bin/nqp-j: command not found
[Coke] oops 19:54
MasterDuke just built it locally, same behavior
[Coke] nqp-js: my $a := $*DOES-NOT-EXIST
camelia sudo: /home/camelia/nqp-js: command not found
MasterDuke the original commits adding some to nqp are 8+ years old, so i doubt JS is a factor 19:55
20:29 AlexDaniel joined
nine m: my int8 $x = 2**7 - 1; say $x++ 20:50
camelia -129
nine But! > ./rakudo-m --optimize=1 -e 'my int8 $x = 2**7 - 1; say $x++'
127
There is a optimize-post-pre-inc-dec-ops method in the optimizer which rewrites ++ on native int/num into pairs of add_* sub_* ops 20:52
MasterDuke man, seems like there have been an abnormally high number of things recently that have been caused by or just had interactions with static optimizer
21:10 reportable6 joined 21:28 psydroid joined 21:35 psydroid left, AlexDaniel left 21:37 AlexDaniel joined
MasterDuke does `find_symbol` have to throw? could it instead return some not-found sentinel? then all the `try`s in nqp/rakudo just for calling `find_symbol` could be a much cheaper check 21:46
21:46 psydroid joined
nine I would like that 21:48
Would also make breaking on MVM_exception_throw_adhoc more useful :)
And exceptions can really be quite expensive due to the need to keep the backtrace
MasterDuke exactly what's prompted this exploration
Voldenet if you want to just return error codes, maybe consider exceptions without stack trace 21:50
MasterDuke the backstory is i saw a couple fails in t/spec/S07-hyperrace/basics.t, but there are tons of "legitimate" exceptions, so breaking on MVM_exception_throw_adhoc was quite annoying 21:51
nqp::(expire|pass_on|left_us|passed|keel_over|extinguish) instead of nqp::die? 21:52
Voldenet nqp::error 21:55
or something similar
nine Oooh...that optimize-post-pre-inc-dec-ops bug gave me the idea to have the static optimizer lower my uint @a; @a[0]++ to nqp::bindpos_u(@a, 0, nqp::atpos_u(@a, 0) + 1). 21:56
21:56 timo left
nine With this, sieve.raku is down to 1.46s (~1.8s before, 3.38s on master). Perl is at 0.43s 21:57
MasterDuke very cool
nine sieve.raku is from that open issue that a sieve implementation was 40x slower in Raku
None of my changes is anywhere ready for merge (much less this side of the release). But all of them should be on the sane side and possible to finish. 21:59
MasterDuke good deal
istr asking this a long while ago, but is there a reason `$a += 2` is so much slower than `$a = $a + 2`? 22:06