[01:03] *** Kaiepi joined [01:05] *** bingos_ joined [01:05] *** samcv_ joined [01:06] *** [Coke]_ joined [01:07] *** bonsaikitten joined [01:08] *** mst_ joined [01:08] *** ChanServ sets mode: +o mst_ [01:12] *** Kaiepi left [01:12] *** xiaomiao left [01:12] *** mst left [01:12] *** [Coke] left [01:12] *** BinGOs left [01:12] *** samcv left [01:37] *** [Coke]_ is now known as [Coke] [01:39] *** Kaiepi joined [02:46] *** vrurg left [03:23] *** vrurg joined [03:37] *** dogbert11 left [03:37] *** dogbert11 joined [04:43] *** dogbert17 joined [04:47] *** dogbert11 left [07:32] *** domidumont joined [07:41] *** Kaiepi left [07:49] *** brrt joined [07:58] MasterDuke: not yet. Have been quite busy with work and aircraft maintenance [08:00] Aircraft maintenance? You own your own? [08:09] *** bingos_ is now known as BinGOs [08:09] No, they're owned by the club. I helped with maintenance of https://segelflieger-linz.at/static/1/7/8/112/image/D-KDAL.JPG and am the primary maintainenance engineer of https://segelflieger-linz.at/static/1/7/8/113/image/D-KFMF.jpg [08:09] *** BinGOs left [08:09] *** BinGOs joined [08:11] That is very cool. Awesome choice of hobby and/or second job. :-) [08:27] but this is in Linz? So how come they are German registered? [08:28] japhb: it's funny that I started doing maintenance with pretty much no prior experience, but I could take a lot of what I learned with aircraft to maintaining my bicycle and stuff in the house hold. I'm pretty sure it's usually the other way round ;0 [08:28] *** notagoodidea joined [08:29] I mean, if the Wright Brothers mythology is to be believed at all, yeah. ;-) [08:29] nwc10: it used to be that registering in Germany was simply cheaper and thanks to the EU it doesn't matter where it's registered. Nowadays we register in Austria as the difference disappeared [08:31] MasterDuke: For what is worth, I kept digging in rakudo to optmize a bit after you hint me to AT-KEY and I landed on this version : https://pastebin.com/R8fSwahF [08:33] For "reasons" applying .lc to lines instead of the inner for loop is faster (but seems less stable in performance with pikes doubling the time) and using is default(0) trait to do a Int comparaison seems faster than using .EXISTS-KEY. [08:39] The simple version was around ~22s on my computer to ~9s now. [08:44] *** Kaiepi joined [08:46] notagoodidea: .lines.lc is kind of cheating, because it's concatenating all the lines together and then calling lc on that. so you aren't really processing line-by-line anymore [08:50] Oh, that's why. [08:52] The time penalty is heavy to move back lc to the inner loop. [08:52] i have a possible patch for rakudo that slightly speeds up the BagHash version, will PR that for comments in a bit [08:53] yeah, it's ~1m calls to .lc instead of just one [08:55] i don't know if we're allowed to assume ascii in the optimized version, but opening/reading with :enc would be faster [08:56] *** sena_kun joined [08:56] Yep, I was looking how to skip the NFC because we can assume ascii by the rules but on $*IN it doesn't seem possible? [09:12] *** frost-lab joined [09:21] *** zakharyas joined [09:51] *** brrt left [10:11] ASCII may be in NFC but it might not be in NFG because \r\n is a single grapheme [10:11] i think `$*IN.encoding("ascii");` will do it [10:13] (But yes, the ASCII decoder can avoid most of the work.) [10:13] I was doing open($*IN, :enc).lines(:close). [10:14] fwiw, it doesn't seem faster for me for this example [10:14] hum [10:16] The open method is a bit faster because it just remove one level of indirection (I took it from the lines method in the IO/Handle source) [10:17] I think. But $*IN.encoding("ascii") set up something, it just return ascii or it must be use with the call to IO.CatHandle etc? [10:19] *** brrt joined [10:25] It changes the currently open handle so that reads from it in the future will use the ASCII decoder [10:27] *** Kaiepi left [10:42] interesting. adding `$*IN.encoding("ascii");` doesn't really make it any faster. however, if i do `for open("kjvbible_x10.txt", :enc).lines` vs `for open("kjvbible_x10.txt").lines` it is about 1s faster (although `for open.lines` is itself about 1s slower than `for "kjvbible_x10.txt".IO.lines` or `for $*IN.lines` [10:44] *** brrt left [10:53] I think it is due to .lines being implementend as open(..).lines() for IO::Handle [10:55] And on the other side, use codesections response on SO (https://stackoverflow.com/a/66500447) with a custom reverse for sort (without dropping to nqp) cut the sort time by half. [10:56] are you using a release or building rakudo from source? [10:57] The rakudo-pkg release (2020.02 I think) [10:57] (On fedora 33 if it can matters) [10:58] ah, i'm building from source so i have the recent commits that (at least mostly) fix that [10:58] (2021.02 sorry) [11:00] It is also possible to shove some times if the .put for %w form could be avoided to a way to print without for loop put respecting the constraints of 1 pair by line. [11:00] jnthn: nice riddle you crated there :D https://github.com/rakudo/rakudo/pull/4253 [11:01] jnthn: a perf report of this example shows the most expensive function is MVM_multi_cache_find_callsite_args. i assume this oddity can be ignored because new-disp is likely to change things? [11:05] nqp::until(nqp::defined($continuation), nqp::null), i.e. busy waiting would also fix it. I wonder if that'd be a better solution? The situation should be pretty rare and I guess the busy wait would be much cheaper than $l.protect [11:13] MasterDuke: At the very least it's not going to exist after new-disp [11:14] nine: Hmmmmmm. [11:19] cool [11:20] jnthn: what order do you expect new-disp and RakuAST to "land" in? [11:20] new-disp first [11:20] By quite a long way [11:22] Doing that way around means less re-work of things in RakuAST [11:23] It can just depend on the new-disp way from the start [11:25] hm. the BagHash version of this example can be sped up by changing https://github.com/rakudo/rakudo/blob/master/src/core.c/Rakudo/QuantHash.pm6#L584-L593 to replace the existskey with the atkey [11:26] but that's only faster if the exitskey is usually true [11:29] hmmm... interesting point! [11:30] MasterDuke: what are you using as benchmark ? [11:31] `my BagHash $w .= new; $w.add($_.lc.words) for "kjvbible_x10.txt".IO.lines; say .key, .value for $w.pairs.sort(-*.value);` [11:36] i think the `my %w := bag "kjvbible_x10.txt".IO.lines>>.lc.words; say .key, .value for %w.pairs.sort(-*.value);` version also had ADD-ITERATOR-TO-BAG as the most expensive function [11:42] now this is interesting. i did see an improvement in that example with the change made. but an nqp micro-benchmark doesn't [11:43] nqp: my %a; %a := 1; my int $c := 0; my int $i := 0; my num $s := nqp::time_n(); while $i++ < 100_000_000 { if nqp::existskey(%a, "c") { my $b := nqp::atkey(%a, "c"); $c := $c + $b }; }; say(nqp::sub_n(nqp::time_n(), $s)); say($c) [11:43] nqp-moarvm: OUTPUT: «0.6337792873382568␤0␤» [11:43] nqp: my %a; %a := 1; my int $c := 0; my int $i := 0; my num $s := nqp::time_n(); while $i++ < 100_000_000 { if (my $b := nqp::atkey(%a, "c")) { $c := $c + $b }; }; say(nqp::sub_n(nqp::time_n(), $s)); say($c) [11:43] nqp-moarvm: OUTPUT: «1.081580400466919␤0␤» [11:43] the key isn't found and existskey is faster, no surprise [11:44] nqp: my %a; %a := 1; my int $c := 0; my int $i := 0; my num $s := nqp::time_n(); while $i++ < 100_000_000 { if nqp::existskey(%a, "c") { my $b := nqp::atkey(%a, "c"); $c := $c + $b }; }; say(nqp::sub_n(nqp::time_n(), $s)); say($c) [11:44] nqp-moarvm: OUTPUT: «2.2597131729125977␤100000000␤» [11:44] nqp: my %a; %a := 1; my int $c := 0; my int $i := 0; my num $s := nqp::time_n(); while $i++ < 100_000_000 { if (my $b := nqp::atkey(%a, "c")) { $c := $c + $b }; }; say(nqp::sub_n(nqp::time_n(), $s)); say($c) [11:44] nqp-moarvm: OUTPUT: «2.331805944442749␤100000000␤» [11:44] the key is found and existskey is still faster, surprise [11:46] and i actually see a bigger difference locally in the case where the key is there. 2.2s for existskey and 2.6s for atkey [11:48] oh, and that was on my remove_spesh_optimizations moarvm branch. on master the atkey version is slower still, 2.9s [11:51] *** Kaiepi joined [12:08] *** zakharyas left [12:13] MasterDuke: preliminary tests show that maybe 1-2% can be gained on BagHash.add in the case of keys already existing, by using nqp::ifnull(nqp::atkey [12:14] so that a lookup would only need to be done once [12:14] the same opt could be done for basically all of the methods in src/core.c/Rakudo/QuantHash.pm6 [12:16] what I *did* find is that 20% of CPU is used by prefix<--> in the case of my %bh is BagHash; %bh.add(42 xx 1000000 [12:19] so I'm going to focus on that [12:19] *** Geth joined [12:19] MasterDuke: https://github.com/rakudo/rakudo/commit/7c0a556e9ca0b2f7e150c5ce2e3127d06029bfcc [12:31] on master, this segfaults most of the time: [12:31] $ raku --profile -e 'my @a = 42 xx 10_000_00' [12:48] *** sena_kun left [12:52] *** sena_kun joined [12:57] so far it hasn't segfaulted for me even with 100_000_000 [12:57] *** MasterDuke left [12:57] *** MasterDuke joined [14:07] *** zakharyas joined [14:45] Huh? unless nqp::defined($continuation) { $l.lock; $l.unlock; } nqp::continuationinvoke... does not actually fix the issue. Taking the lock undiscriminately does. As does busy waiting and ignoring the lock. [14:47] *** frost-lab left [15:55] Ah, it should be unless nqp::defined(nqp::decont($continuation)) [15:55] or no...that's not it either [16:05] nqp::isconcrete is perhaps a safer bet [16:05] But still not sure why it'd be wrong [16:06] What's also odd is that I just cannot provoke the error without heavy system load, even if I add a huge delay before the $continuation := c; [16:07] But as soon as I run some TEST_JOBS=80 make stresstest, it fails [16:08] afk for an hour [16:10] *** evalable6 left [16:12] *** evalable6 joined [17:20] Finally....s/huge delay/gigantic delay/ did the job [17:37] *** zakharyas left [18:19] *** notagoodidea left [18:24] *** zakharyas joined [18:29] *** domidumont left [18:56] *** lizmat_ joined [19:00] *** lizmat left [19:18] *** zakharyas left [19:34] *** brrt joined [20:30] *** brrt left [21:28] *** lizmat_ is now known as lizmat [21:54] *** mst_ is now known as mst [23:32] *** dogbert17 left [23:33] *** dogbert17 joined [23:48] *** dogbert17 left [23:49] *** dogbert17 joined [23:51] *** dogbert11 joined [23:54] *** dogbert17 left