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 oh wow. with a rough optimization applied to coerce_i_s, `MVM_SPESH_BLOCKING=1 nqp-m -e 'my str $s; my int $i := 0; my $n := nqp::time; while $i++ < 10_000_000 { $s := $i }; say(nqp::div_n(nqp::time - $n, 1000000000e0)); say($s)'` drops from ~0.270s to ~0.145s 02:21
japhb Nice! What's the optimization? 02:37
MasterDuke using in-situ strings if the length is small enough. so no allocation for the string's storage 02:39
japhb It still stuns me how expensive allocation is in C code 02:47
MasterDuke and we're even using mimalloc by default. if i build with --no-mimalloc the non-optimized version increases to ~0.355s. optimized is almost as fast at ~0.153s 02:50
well, it'll take me a little while to do all the polishing and optimizing, but i'm happy to see there appears to be some noticeable gains to be had 02:52
off to bed for today & 02:54
07:12 MasterDuke left
Woodi japhb: allocations in C expensive comparing to what ? asm ? preallocated memory (without gc'ing that memory) ? just expensive ? :) asking becouse "C allocation" is close to OS or just what used allocator gives... 07:16
08:14 sena_kun joined
japhb Woodi: Compared to what you do with that memory -- the mere fact that allocating memory can often dominate the cost of operations on the contents of that memory. 14:18
Woodi japhb: probably "high level languages" are to be blamed for this :) 14:33
so MVMString * MVM_coerce_i_s(MVMThreadContext *tc, MVMint64 i, char *buffer, int len) { to reuse buffer can help here ? 14:35
just compiler need to recognize for(int i = 0 .. 100000000) { ... } case and reuse buffer :) 14:37
in math: ax + bx = x(a + b) is some optimalization that recognize such pattern ? where x*something is passing common varible to function ;) 15:01
nine That would require the compiler to proove that evaluating x does not have any side effects 15:07
Woodi I was lastly reading about Vala lang an they had example of pure function that print to a screen... probably big side efect in some languages :) 17:35
23:26 sena_kun left