🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). This channel is logged for the purpose of keeping a history about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | Log inspection is getting closer to beta. If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 25 August 2021.
00:08 reportable6 left 01:08 greppable6 left, squashable6 left, shareable6 left, evalable6 left, bisectable6 left, notable6 left, bloatable6 left, sourceable6 left, committable6 left, linkable6 left, quotable6 left, releasable6 left, nativecallable6 left, coverable6 left, statisfiable6 left, tellable6 left, benchable6 left, unicodable6 left, coverable6 joined 01:09 unicodable6 joined, squashable6 joined, evalable6 joined 01:10 notable6 joined 01:11 benchable6 joined, sourceable6 joined, nativecallable6 joined 01:59 Shane__ joined 02:09 quotable6 joined, committable6 joined 02:10 releasable6 joined 02:11 bisectable6 joined 03:09 shareable6 joined, reportable6 joined 03:10 bloatable6 joined, tellable6 joined, linkable6 joined 03:56 frost left 03:57 frost joined 04:10 greppable6 joined 05:10 committable6 left, quotable6 left, bisectable6 left, releasable6 left, nativecallable6 left, coverable6 left, sourceable6 left, notable6 left, linkable6 left, bloatable6 left, greppable6 left, benchable6 left, squashable6 left, shareable6 left, evalable6 left, tellable6 left, reportable6 left, unicodable6 left 05:11 linkable6 joined, unicodable6 joined, notable6 joined, sourceable6 joined 05:12 bloatable6 joined, bisectable6 joined, shareable6 joined 05:13 benchable6 joined, releasable6 joined, reportable6 joined, nativecallable6 joined, greppable6 joined, tellable6 joined 06:07 reportable6 left 06:10 reportable6 joined 06:11 quotable6 joined 06:12 evalable6 joined 06:17 frost left 06:21 frost joined 06:27 frost left 06:49 frost joined
guifa interesting 06:52
Apparently the most performant way to create an object with numerous attributes is just self.bless: attr-a => foo, attr-b => bar
I have a bunch of classes where .new receives an Array-like bit of data, so I figured all of the hashy stuff involved with named arguments would be a slow down 06:54
passing the array through to BUILD or TWEAK and directly setting the attributes ($!attr-a = @args[0]; $!attr-b = @args[1], …) was about 50% slower than self.bless: attr-a => @args[0], attr-b => @args[1], …) 06:57
07:09 statisfiable6 joined 07:11 abraxxa joined, jjido joined 07:13 squashable6 joined 07:17 abraxxa left 07:18 abraxxa joined 07:32 Darkcoal joined
nine guifa: we have spent considerable time to optimize object construction, so it's not terribly surprising that it's actually quite fast :) 07:51
07:57 MasterDuke left 08:12 coverable6 joined 08:13 committable6 joined 08:16 jjido left 08:26 abraxxa left 08:28 abraxxa joined
elcaro guifa: Yeah, I've found with a couple AoC puzzles. Sometime I'd write a solution using a hash, but when the "keys" are known at compiletime, using a class (where "keys" == method) even an anon class trounced the hash in runtime 09:23
09:24 Sgeo left 09:26 ProperN[out] joined 09:27 ProperNoun left 10:27 evalable6 left, linkable6 left 10:28 evalable6 joined
codesections guifa/elcaro: for some (2019) benchmark numbers on object construction, see jnthn's Performance Update talk jnthn.net/papers/2019-perlcon-performance.pdf 10:43
(esp. slides 90+)
Nemokosch > Destructuring (and signature unpacks) 11:04
came across this one 😅
11:28 evalable6 left 11:30 linkable6 joined, evalable6 joined 12:07 abraxxa left 12:08 abraxxa joined, abraxxa left, reportable6 left 12:09 abraxxa-home joined 12:11 frost left 12:45 Altai-man joined 12:58 tejr left 13:03 tejr joined, rypervenche left 13:10 reportable6 joined
guifa nine: yeah, I knew there had been a lot of work on it, but it was just surprising that the direct assignment was so much slower 14:16
the penalty for direct assignment (via TWEAK, BUILD, or similar) is quite substantial 14:17
gist.github.com/alabamenhu/86ee3f2...2bc4d528be 14:19
^^ designed to roughly mirror how most of the stuff is made in CLDR and the different classes are things I think I've tried in the past / am using now / considered using. 14:23
I've been using method B, so switching to A whenever I can and G when I can't should get me a pretty massive improvement at runtime 14:33
14:41 Altai-man left, Altai-man joined 14:50 dogbert11 joined 14:51 sena_kun_ joined, Kaipi joined, guifa_ joined 14:52 vrurg_ joined, sftp_ joined, jrjsmrtn_ joined 14:53 greyrat_ joined 14:55 djerius left, japhb_ joined, djerius joined 14:56 Maylay_ joined 14:57 perlmaros_ joined 14:58 phogg` joined 14:59 Altai-man left, greyrat left, sena_kun left, japhb left, perlmaros left, Kaiepi left, guifa left, dogbert17 left, vrurg left, sftp left, juanfra__ left, jrjsmrtn left, phogg left, gugod left, Maylay left, perlmaros_ is now known as perlmaros, sftp_ is now known as sftp 15:00 sena_kun joined 15:02 gugod joined
codesections m: my class A {}; say A.^lookup('BUILD'); say A.^lookup('TWEAK'); say A.^lookup('bless') 15:14
camelia (Mu)
(Mu)
bless
codesections ^^^^ guifa_my understanding is that classes always have a .bless method but *don't* have a BUILD/TWEAK unless you give them one. So using BUILD/TWEAK involves an extra method call (not an alternative one) 15:15
and the pre-assignment options (F & G) are declaring extra variables, so I'm not surprised to see a bit of a slowdown there 15:20
15:21 Sgeo joined
codesections (I _am_ a bit surprised to see how slow the dynamic BUILD is. I would have bet on it being slower than BUILD, but a 2.7× difference is a lot 15:25
)
guifa_ codesections yeah, I figured the pre-assignment would be slower, test just shows how much slower 15:55
Optimizations in theory could remove those assignments, I'd think, just didn't know how strong the static optimizer was for that type of stuff 15:58
codesections My understanding is that, right now, there's almost no static optimization – lots of JIT optimization, but not much static. (But I'm hardly an expert) 16:01
guifa_ In any case, this adds one more thing for me to do while I'm cleaning up code in CLDR 16:03
but with the nice side effect of it probably reducing up the load time for language data by nearly 50% 16:04
it's just … so many files to update hahaha (I think it was gfldex that ran the numbers and it's the largest module by LOC in the ecosystem) 16:07
16:21 evalable6 left, linkable6 left 16:22 linkable6 joined 16:23 evalable6 joined
japhb_ guifa_: How do all those compare with *not* overriding new, and just instantiating a class with 12 attributes the "old fashioned way"? 16:39
16:40 japhb_ is now known as japhb
guifa_ japhb_ : good question. That doesn't work in my case (the .new for CLDR types passes an index and a blob: no type has knowledge of other types are constructed), but I'll try adding it to the test suit 16:42
japhb_ it's basically the same speed, which kind of makes sense. I think the base .new is just method new (|c) { self.bless: |c }, and in both cases they'll be the multi dispatcher's first attempt 16:54
japhb Nod 16:55
17:40 jjido joined 17:54 phogg` is now known as phogg, phogg left, phogg joined 17:57 jjido left 18:08 reportable6 left 18:33 jjido joined 19:04 jjido left 19:10 reportable6 joined 19:11 sena_kun_ left 20:11 evalable6 left, linkable6 left 20:13 evalable6 joined 21:01 jaguart left, jaguart joined 21:04 abraxxa-home left 21:13 linkable6 joined 21:25 Darkcoal left 22:18 MasterDuke joined 23:18 committable6 left, evalable6 left, reportable6 left, coverable6 left, squashable6 left, linkable6 left, notable6 left, sourceable6 left, greppable6 left, statisfiable6 left, benchable6 left, nativecallable6 left, shareable6 left, unicodable6 left, quotable6 left, releasable6 left, bisectable6 left, bloatable6 left, tellable6 left 23:19 quotable6 joined, benchable6 joined, bisectable6 joined, linkable6 joined 23:20 coverable6 joined, notable6 joined, greppable6 joined 23:21 reportable6 joined, squashable6 joined, shareable6 joined