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.
MasterDuke unless i hear any objections i'll merge my two prs in the next day or two 00:11
MasterDuke i have a WIP patch to rakudo's static optimizer that rewrites `($a, $b) = ($c, $d);` into `$a = $c; $b = $d;`. it takes `MVM_SPESH_BLOCKING=1 raku -e 'my $a = 1; my $b = 2; for ^1_000_000 { ($a, $b) = ($_, $_ + 1) }; say "a = $a, b = $b"; say now - INIT now'` from ~0.8s down to ~0.3s. however, there are currently almost no restrictions on when it 04:01
kicks in (i haven't even tried a spectest yet). anyone have a suggestion on when we know this transformation is safe?
off to sleep, but i'll check back tomorrow evening 04:02
japhb Pretty sure it wouldn't be if $c is a Slip ... 05:12
nine MasterDuke: that optimization looks dangerous. I wouldn't risk it. You know what's not dangerous? Working on RakuAST! :D :D 08:29
.oO(One of these days, someone will do it, just to shut up my obnoxious advertising)
08:30
jnthn I think the optimization is pretty safe if you can see that the Scalar, since it creation, has only been assigned to, not rebound. 10:15
'cus in that case you know that it's a Scalar container and that the Scalar nature of it will beat any contained Slip, etc.
Kaipei MasterDuke, list assignments like those are ridiculously slow via List. if you can pull that without breaking lazy tails via `my ($, +/*/**)`, that'd be neat 15:14
be careful not to break ($a, $b) = ($b, $a) in the process 15:16
Kaiepi albeit risky, there is a subset of assignments that that would apply to that the optimizer could better figure out than List on its own 15:21
MasterDuke nine: heh, i do intent to work on rakuast, but this was quick to implement...well, this POC was, i suspect a real implementation might be a bit longer though... 23:35
jnthn: thanks, good to know. however, that particular restriction is not one i've implemented before, and i don't see anything that jumps out at me in the rest of the optimizer code. any pointers to where something like that has been done before? 23:37
Kaiepi: yeah, that was what i was originally testing with and saw that it did in fact break with what i have now. that's why i'm trying to figure out when it's safe to do 23:38
jnthn: also, i currently have to have `self.visit_op_children($op);` before i build the new QAST, or i get something like `assign requires a concrete object (got a Rakudo::Internals::LoweredAwayLexical type object instead)` 23:43
oh, btw, making it a p6assign instead of regular assign dropped it down to ~0.05, about the same as writing the two assignments manually 23:55