🦋 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 available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 8 June 2022.
00:06 Sankalp- joined, Sankalp left, Sankalp- is now known as Sankalp 00:08 reportable6 left 00:09 reportable6 joined 00:38 [Coke] left 00:42 [Coke] joined 01:13 aris32 left 01:16 lichtkind left 01:21 summer left 02:21 evalable6 left, linkable6 left 02:23 linkable6 joined 02:24 evalable6 joined 03:24 linkable6 left, evalable6 left 03:27 linkable6 joined, evalable6 joined 03:38 Sankalp left 03:42 Sankalp joined 04:16 vrurg left 04:17 vrurg joined 05:04 andinus left, donpdonp|z_ left, dg left, jjatria left, broquain1 left, pat_js left, broquaint joined, donpdonp|z_ joined, jjatria joined, dg joined, andinus joined, pat_js joined 05:07 avuserow left, dcx left, phogg left, tailgate left, bartolin_ left, JRaspass left, El_Che left, goblin left, renormalist left, El_Che joined, goblin joined, renormalist joined, bartolin joined, avuserow joined 05:08 JRaspass joined, phogg joined 05:09 tailgate joined, dcx joined 06:07 reportable6 left 06:09 reportable6 joined 07:09 evalable6 left, linkable6 left, Sgeo left 07:11 evalable6 joined 07:12 linkable6 joined 07:48 Sankalp left, dakkar joined 07:51 sena_kun joined 07:53 Sankalp joined 07:54 ab5tract joined 07:56 sena_kun left 07:57 sena_kun joined
Nemokosch A few things: 08:06
1. I kept so much time pondering on the performance
of HTML::Tag using --profile that I still haven't checked HTML::Entities::Fast, sorry
of HTML::Tag using --profile that I still haven't checked HTML::Entity::Fast, sorry
2. I got basically nowhere... I would be really thankful if someone more knowledgeable could point out what is so costly about .render. Now I uploaded the version benchmarked to both github and fez as the latest version <gist.github.com/2colours/6de5e16b4...fc8b4a> also I made this little test file which is how I tried to see the expensive part 08:08
what really hits me is the number of sink calls - where do they come from?
3. Where to look for the rakudo profile HTML file generation? I would take a look for it, maybe I could add a more useful navigation back and forth; I would have been happy if there was something like that. 08:10
since it's an SPA, I would hope that it cannot be too difficult... the content must be loaded some way, the same data could be identified and stored in the window history 08:11
lizmat timo knows 08:17
tellable6 2022-07-24T23:26:51Z #raku <melezhik> lizmat for some reasons rak does not search on my SparkyCI alpine test box - sparrowhub.io:2222/report/914 - but maybe this Rakudo version thing?
08:18 jdv left 08:19 vasko joined, vasko left, vasko joined 08:24 jdv joined
timo Nemokosch, the profiler html app lives in the nqp repository, i think under src/vm/moar or so 08:24
Nemokosch Oh right 08:39
github.com/Raku/nqp/blob/master/sr...plate.html
timo there's also moarperf, which has a Cro backend to do some heavy lifting for you, and also supports the memory snapshot profiler 08:43
Nemokosch haha, heard of it! 08:56
timo i wish i had more energy for it next to my day job 08:57
at the day job i'm working with svelte and some of the performance benefits it has over react could be amazing for moarperf
08:58 ab5tract left
Nemokosch is the code of this template file deliberately this legacy-ish? 08:58
because I doubt the history api would work with browsers that demand this sort of code 08:59
timo it hasn't been touched in a couple of years 09:03
it's still the previous version of angular
Nemokosch It doesn't help that I'm clueless about angular... 09:08
or pretty much any JS frontend frameworks for that matter
timo back and forth navigation would indeed be cool, yeah 09:10
moarperf tries to do that, i don't remember how well i got it to work 09:11
09:17 sena_kun left
timo regarding sink calls, often times they can be almost completely optimized away, and in the profiling case, overhead from recording the call and return may balloon up the cost artificially, so that's a thing to keep in mind 09:22
09:23 djerius left, djerius_ joined
lizmat yeah, that's the uncertainty principle at work there :-) 09:28
SmokeMachine maybe you could use component-like solution Raku-only like what I was playing with last weekend... github.com/FCO/Cro-WebSocket-WebComponents-test (I'm still trying to understand how useful it is...) 09:29
sorry... it seems there is no server on what you are talking... sorry... 09:30
timo moarperf does have a server, the SPA for the default --profile does not
the most reliable way to figure out if the sink calls are actually cheap is to read the spesh log, but that's a science unto itself 09:32
lizmat: haven't looked if you added more to the spesh module, could this be something it could learn, how good sink calls are handled? %)
jaguart JRasspass++ - thank you! I see that raku.land/github:jsimonet/Log::Any and friends have readme! 09:33
lizmat I haven't touched the Spesh module for a long time
timo that's fine 09:34
Nemokosch I mean, the profiler wouldn't lie that they are costly, right? ... 09:39
timo i think it does try to measure the overhead of measuring a call up front, so that it can subtract that
09:40 amenonsen left, amenonsen joined
lizmat the profile inserts code that (sometime? always?) prevents inlining, so it *can* make a difference 09:40
09:40 lichtkind joined
timo it tries not to prevent inlining 09:40
i'm not sure when it does prevent it? 09:41
lizmat when it puts the size above the inlining limit ?
timo i definitely wrote code to subtract profiling-added instruction sizes 09:42
it may not be in master, but i sure hope it is :) :)
Nemokosch I mean, really, if you have time, I'd be more than thankful if you took a look at it. I uploaded both the module and a little gist that I tried to analyze. 09:43
timo installing zef as we speak 09:47
10:01 sena_kun joined 10:05 Kaiepi left
timo i froze up my computer for a bit there :D 10:05
are the tests supposed to be clean? because i do have some failures
10:07 Kaiepi joined
Nemokosch aaaah bruh 10:10
one space is missing
timo the benchmark only runs for one second, that's really not much for benchmarking 10:11
Nemokosch ... 10:12
Liz told me that the HTML gets out of hand if it runs for longer :heh:
decide you guys
lizmat depends on the browser you use, I guess... 10:14
my experience is that if you profile something that runs longer than a few seconds, you get a HTML file of several MBs that at least Safari basically chokes on 10:15
timo Seq.pm's sink spends a lot of time inclusive but barely an time exclusive, which looks to me like that just does the work of a loop, like a for loop or so 10:16
Nemokosch I'm gonna upload the test-passing version, thank you for noticing the big dumb
I'm not sure what you are looking at 10:18
7.01 ms just on sinks, exclusive time
compared to 9.75ms on maps, exclusive time
the percentages are quite surely wrong in the exclusive time column
but they are wrong consistently, at least 10:19
timo map itself shouldn't do much at all 10:27
2ms on List sink, 30ms on List's sink 10:28
map 18.6ms exclusive time
"The profiled code ran for 264.96ms. Of this, 56.37ms were spent on garbage collection (that's 21.27%)." 10:30
Nemokosch Still, these are at the top 10:39
timo could be from being called a whole lot, too :)
i put a `for ^10 {` around the code including the "render to file" call 10:40
Nemokosch okay 10:41
timo sorting exclusive time now puts sink far to the bottom 10:42
Nemokosch also, thank you for the help either way, I really spent hours pondering about it and got nowhere, partly because I don't comprehend the generated data itself 10:43
timo yes it definitely is A Bit Much
List.pm's sink is at 142130 calls total, 1% inclusive, 0.5% exclusive time 10:44
so each individual call does barely anything apparently
Nemokosch I don't know/think that it's the main reason for the module (and the render call in particular!) to be this slow 10:45
But it got my attention why there is such a big number of sink calls in the first place 10:46
I don't see how it would follow from the code 10:47
timo right, sink calls are generated in the background and we rely on optimization to throw them out when they are not needed
11:07 evalable6 left, linkable6 left 11:09 evalable6 joined 11:10 linkable6 joined 12:06 reportable6 left 12:07 [Coke] left 12:09 reportable6 joined 12:11 Xliff left 12:27 [Coke] joined 13:27 evalable6 left, linkable6 left 13:30 linkable6 joined, evalable6 joined 13:46 morte_ joined 13:54 Xliff joined
Xliff \o 13:54
Is it possible to adjust the timezone of an existing datetime instance? 13:55
: my $dt = DateTime.new( year => 2021, month => 12, day => 1); $dt.gist.say; $dt.timezone = -14400; $dt.gist.say
m: my $dt = DateTime.new( year => 2021, month => 12, day => 1); $dt.gist.say; $dt.timezone = -14400; $dt.gist.say
camelia 2021-12-01T00:00:00Z
Cannot modify an immutable Int (0)
in block <unit> at <tmp> line 1
Xliff This seems oddly limiting to me.
Nemokosch what? immutability? 13:57
Xliff Well, the fact that you can't adjust the timezone. Yes. 13:59
Nemokosch look docs.raku.org/type/DateTime#method_in-timezone
Xliff At least, not without creating a new DateTime object.
Oh, LOL! My eyes skipped right over that. I thought that method meant "Is object 'in this timezone'" 14:00
Nemokosch++
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2022/07/25/2022-30-what/ 14:01
Nemokosch yeah, tbf the name is disturbing 14:04
why not with-timezone or something
14:07 DarthGandalf left, Tirifto left
lizmat I wonder if raku.land/zef:lizmat/Method::Also would work on core classes 14:08
afk& 14:10
14:13 Sgeo joined 14:28 sena_kun left, Altai-man joined
Xliff lizmat++ 14:28
14:29 DarthGandalf joined
Xliff What's the best way to pass a parameter to an grammar action class? Can you .new? 14:29
Voldenet sure you can 14:37
m: grammar { rule TOP { .+ } }.parse("whatever", :actions(class :: { has $.x; method TOP ($/) { make ($.x ~~ ~$/) } }.new(:x("whatever")))).made.say 14:38
camelia True
14:57 melezhik joined
melezhik o/ 14:57
Hi lizmat - any thoughts on this App-Rak failure? - sparrowhub.io:2222/report/912
15:03 wingfold joined
melezhik I also create a positive/negative test for App-Rak search within dir - in "Sparrow" style - raw.githubusercontent.com/melezhik...7CBF2.jpeg 15:09
15:17 Tirifto joined 15:20 melezhik left 16:16 morte_ left 16:22 alethkit left, patrickb left 16:27 alethkit joined, patrickb joined 16:34 alethkit left, patrickb left 16:36 patrickb joined 16:37 alethkit joined 16:42 dakkar left, morte_ joined 17:06 Altai-man left 17:21 alethkit left, patrickb left 17:22 patrickb joined
Nemokosch For the whatever anomaly I've shown... 17:22
17:23 alethkit joined
Either I'm very stupid some way or some serious issue is going on 17:23
but I can't be _that_ stupid, after all, I just expect { .&function($second-argument) } and *.&function($second-argument) do exactly the same thing regardless of context... 17:32
also this cannot be just a parsing error because the behavior changes if the argument I try to bind is a fully fledged local variable, not a function parameter itself 17:33
it goes from Mu to Any
so it does take something, after all
17:42 sena_kun joined 17:51 lizmat_ joined 17:52 discord-raku-bot left 17:53 gfldex left 17:55 lizmat left, Xliff left 18:00 lizmat_ is now known as lizmat 18:06 reportable6 left 18:09 reportable6 joined 18:15 mexen joined, Nemokosch joined
Nemokosch . 18:16
For the weird parameter problem earlier
I have a reasonably golf-ish way to do it, I still don't understand the behavior even if it is possibly correct 18:17
what I need is a function with 2 arguments and another function with andthen .map andthen .map chaining in it 18:18
m: sub lin5($a, $b) { 5*$a + $b }; sub problems($x) { (1 .. 100).roll(10) andthen .map(* + 2) andthen .map(*.&lin5($x)) }; say problems(10) 18:19
camelia Type check failed in binding to parameter '$b'; expected Any but got Mu (Mu)
in sub lin5 at <tmp> line 1
in block <unit> at <tmp> line 1
Nemokosch I don't see how I messed up the precedence if I did 18:20
the WhateverCode bit sees $x but not its actual value
if I define a variable inside the function and try to pass that, it will be (Any) instead of (Mu) 18:21
m: sub lin5($a, $b) { 5*$a + $b }; sub problems($x) { my $y = 11; (1 .. 100).roll(10) andthen .map(* + 2) andthen .map(*.&lin5($y)) }; say problems(10)
camelia Use of uninitialized value of type Any in numeric context
(250 95 375 270 270 420 170 310 90 340)
in sub lin5 at <tmp> line 1
Use of uninitialized value of type Any in numeric context
in sub lin5 at <tmp> line 1
Use of uninitialized valu…
Nemokosch any idea ^^ 18:22
18:23 Nemokosch left
Voldenet you _can't_ do .map(*.&lin5($y)) 18:43
m: sub lin5($a, $b) { 5*$a + $b }; sub problems($x) { my $y = 11; (1 .. 100).roll(10) andthen .map(* + 2) andthen .map({.&lin5($y)}) }; say problems(10)
camelia (166 211 156 436 146 361 396 486 146 276)
18:55 sena_kun left 18:56 sena_kun joined
Voldenet it is a bit weird to me that $y is Any in this context, but method calls with whatever-star always cause problems to me 18:58
19:20 irc_user joined 19:25 Nemokosch joined
Nemokosch Actually, you _can_ 19:27
 m: sub lin5($a, $b) { 5*$a + $b }; sub problems($x) { my $y = 11; (1 .. 100).roll(10).map(* + 2) andthen .map(*.&lin5($y)) }; say problems(10)
camelia (131 426 391 311 206 46 141 421 156 511)
Nemokosch literally one andthen less and it works 19:28
I can agree that WhateverCode usually gets one into trouble - but this very apparently can work so it sounds more like a personal opinion that one can't use it here :P 19:29
m: sub lin5($a, $b) { 5*$a + $b }; sub problems($x) { (1 .. 100).roll(10).map(* + 2) andthen .map(*.&lin5($x)) }; say problems(10) 19:31
camelia (165 225 205 120 50 340 330 295 450 220)
Nemokosch right, this works with the parameter as well
Voldenet "can work" never beats "will always work" ;) 19:36
Nemokosch it beats "can't work", however 19:38
Voldenet true that :) 19:43
19:49 sena_kun left 19:50 sena_kun joined 19:56 morte_ left 19:59 Nemokosch left
Voldenet m: sub lin5($a, $b) { 5*$a + $b }; sub problems($x) { my $y = 11; (1 .. 100).roll(10) andthen .map(* + 2) andthen { .map(*.&lin5($y)) } }; say problems(10) 20:07
camelia (46 271 76 271 71 396 506 366 491 416)
Voldenet …uh oh
20:12 Nemokosch joined
Nemokosch what's up 20:12
Voldenet that looks like a bug of some sort 20:15
Nemokosch what is this, even, a code block out of the blue? because andthen is an operator, not a statement 20:17
sometimes I can't decide if the problem is that something works or that it doesn't 20:18
oh wait... andthen creates a block from the right side 20:19
Voldenet I've been swimming a bit in –target=ast and apparently nothing gets bound to a declared variable 20:20
20:25 vrurg left
Nemokosch vrurg already fleeing 20:26
Voldenet I'm unsure if I'm even right though, reading qast is difficult 20:34
jjatria Is there a way to load a module at runtime while validating auth and version? I can do `require`, but that seems to ignore `:auth<>` and `:ver<>` 20:35
Voldenet "validating"? 20:44
you use the module with version an auth
e.g. > use MIME::Base64:ver<1.2.3>:auth<zef:raku-community-modules>
jjatria But that is at compile time
"validating" = "making sure that the one I loaded is the one I think I loaded" 20:45
Voldenet there's ^auth and ^api on ModuleHOW but I'm not sure whether it returns anything useful: `(require MIME::Base64).^auth.say` has usable result but `(require Libarchive).^auth.say` doesn't 21:13
21:14 discord-raku-bot joined
Nemokosch m: sub lin5($a, $b) { 5*$a + $b }; sub problems($x) { (1 .. 100).roll(10) andthen ( .map(* + 2) andthen  .map(*.&lin5($y)) ) }; say problems(10) 21:14
camelia ===SORRY!=== Error while compiling <tmp>
Variable '$y' is not declared. Perhaps you forgot a 'sub' if this was
intended to be part of a signature?
at <tmp>:1
------> hen ( .map(* + 2) andthen  .map(*.&lin5(⏏$y)) ) }; say proble…
Nemokosch oh right 21:15
m: sub lin5($a, $b) { 5*$a + $b }; sub problems($x) { (1 .. 100).roll(10) andthen ( .map(* + 2) andthen .map(*.&lin5($x)) ) }; say problems(10)
camelia (80 155 200 405 195 150 500 295 480 55)
Nemokosch see? with this precedence, it would work
m: sub lin5($a, $b) { 5*$a + $b }; sub problems($x) { (1 .. 100).roll(10) andthen .map(* + 2) andthen ( .map(*.&lin5($x)) ) }; say problems(10)
camelia Type check failed in binding to parameter '$b'; expected Any but got Mu (Mu)
in sub lin5 at <tmp> line 1
in block <unit> at <tmp> line 1
Nemokosch with this, however
Nemokosch oh cool, we're back again 21:17
Nemokosch anyway, I'm gonna open an issue for this, as usual :D 21:19
21:20 discord-raku-bot left, discord-raku-bot joined
Nemokosch m: sub lin5($a, $b) { 5*$a + $b }; sub problems($x) { (1 .. 100).roll(10) andthen .map(*.&lin5($x)) andthen .map(* + 2) }; say problems(10) 21:26
camelia (297 182 247 272 392 42 402 62 342 262)
Nemokosch the order is also important 21:27
21:27 gfldex joined
Voldenet m: sub lin5($a, $b) { 5*$a + $b }; sub problems($x) { (1 .. 100).roll(10) andthen .map(*.&lin5($x)) andthen .map(* + $x) }; say problems(10) 21:27
camelia Cannot resolve caller infix:<+>(Int:D, VMNull); none of these signatures matches:
($x = 0)
(\a, \b)
(Real $a, Real $b)
(Int:D $a, Int:D $b --> Int:D)
(int $a, int $b --> int)
(uint $a, uint $b --> uint)
(Num:D…
Nemokosch yes yes, that would have been the next remark 21:28
it doesn't even have to be a function call
it can be anything whatevercurried and it has to be on the right
21:28 discord-raku-bot left 21:29 discord-raku-bot joined, irc_user left
Nemokosch m: sub lin5($a, $b) { 5*$a + $b }; sub problems($x) { (1 .. 100).roll(10) andthen .map(* + 2) andthen ( .&(* + $x) ) }; say problems(16) 21:32
camelia 26
Nemokosch This, however, works
this is really annoyingly complicated to reproduce
or describe, for that matter... 21:33
21:38 kjp joined
Nemokosch it's not even that WhateverCode's can't form closures because sometimes it looks like they can, or it's optimized away at least 21:39
21:41 sena_kun left
jjatria Voldenet: yeah, I tried those and they didn't seem to work for me. But knowing after loading that the one I loaded was not the right one doesn't really help if I cannot then somehow load the right one 21:43
Nemokosch github.com/rakudo/rakudo/issues/5004 today's piece of art, lol 21:45
Voldenet "art" :) 21:48
Nemokosch I'd like to think this is art, since it was a huge effort to get to this point with the analysis even 21:49
Voldenet true
jjatria: github.com/rakudo/rakudo/blob/aa5e....nqp#L2354 – I'm looking for hints and it might just be that auth is never being attached when doing `require` 21:50
jjatria Oh, interesting. I wonder if this was intentional 21:53
lizmat I would find that strange, really 21:54
jjatria It does seem like a strange limitation, because both `use` and `need` honour it
Nemokosch I only made one issue today, let's go for it!
lizmat Nemokosch++ 21:55
Nemokosch I would write an issue for that as well, seriously, but for that, first I would need to know the context and so on... also, it would be nice to go to sleep :D 21:57
lizmat yeah, /me is hitting the straw now
Voldenet I could be also reading the code for require wrong, it's sufficiently complex for me 21:58
21:59 Nemokosch left 22:12 vrurg joined 22:33 discord-raku-bot left, discord-raku-bot joined 22:39 melezhik joined
melezhik o/ 22:39
.tell jjatria I bumped on Lorea tool and think that Tomtit could be good combination with it - gitlab.com/jjatria/lorea/-/tree/ma...figuration , what if distribute standard Lorea configurations suitable for different environments (like ruby/Raku/go) as Tomtit profiles ? - github.com/melezhik/Tomtit#profiles , so user can just 22:51
say "tom --profile lorea && tom lorea-ruby-conf" and voila, loira for Ruby configuration file is populated ?
tellable6 melezhik, I'll pass your message to jjatria
melezhik I can drop a simple Tomtit::Profile::Loira module for that or even you can try this ...it's simple coding required ... 22:52
we could even ship Tomtit::Profile::Loira as a dependency of App::Loira , so a user always have uptodate version of Loira config bootstrapers ... 22:54
of App::Loira  -> for of App::Loira
22:56 melezhik left 23:12 maettu left 23:25 wingfold left 23:29 Woodi left 23:38 maettu joined