🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
Geth_ doc/io-path-parts: 6ffd37d4de | (Stoned Elipot)++ | 6 files
Document IO::Path::Parts

  ... and its relation with IO::Path and IO::Spec::*
07:24
doc: stoned++ created pull request #3695:
Document IO::Path::Parts
Geth_ doc: 9829605de9 | (Stoned Elipot)++ (committed by Juan Julián Merelo Guervós) | 6 files
Document IO::Path::Parts

  ... and its relation with IO::Path and IO::Spec::*
08:57
tib Hello, with profiling, is there a way to have an idea of how many time was spent for allocation of a type of objects ? There is a link to routine that made the allocation but the time spent in the routine is includes more than only the allocation. 09:13
(and after checking the profile.json, the allocations { } blocks only contains type and number of allocs) 09:14
MasterDuke tib: i don't think so. but timotimo++ probably knows the profiler the best 09:18
hm. have you checked if there's a new() for that type in the rountines tab? and if so, does the number of times it's been called match the count of allocations? 09:19
looks like there can be a match between the two, but only for higher-level types (i.e., works for something like Rakudo::Iterator, but not BOOTHash) 09:21
tib nothing match :/ 09:22
MasterDuke timotimo: any other ideas? 09:24
tib: is there any particular types you're interested in? 09:26
timotimo some REPRs do more work to initialize than others 09:32
i.e. some are just allocated, and some have a little extra function
tib Actually, I wanted to see the cost of allocation, I have a case where I allocate a lot of Int versus another where I allocate nothing at all. Both performs the same when optimization are enabled. 09:34
timotimo interesting
tib Probably because allocation time is very small and there is autoboxing.
But that's just a supposition
timotimo allocation cost gets amortized by the GC kicking in whenever a limit is reached
so if you record the allocation time for types, whether a given type will have a lot or almost nothing depends entirely on luck of the draw 09:35
tib There are some hints in this talk www.jnthn.net/papers/2011-tcpw-optimization.pdf (page 51, 52) that make me feel that time is spent elsewhere than alloc 09:40
and if I disable moarvm optims, of course the version with a lot of Int allocs becomes much much longer (as "expected") 09:41
timotimo you can get the exact code that moarvm makes for your functions 09:42
the env var MVM_SPESH_LOG set to a filename will spit that out 09:43
tib oh, thank you
Since we are talking about profiling, do you know if there is a way to have better routines names in profiler ? I tried to name loops (MYLOOP: loop ...) but it is "lost" later in report 09:45
timotimo you can use subs, other than that it'll unfortunately just be line numbers and filenames 09:46
tib ok thank you 09:52
JJAtria[m] moritz: Is the version of your book in www.apress.com/gp/book/9781484232279 the latest one? Since the title is pre-rename, I'm not sure I'm looking at the right entry 😅 10:35
moritz JJAtria[m]: yes, it's the latest. There isn't a Raku revision of that book yet 10:55
nor do I think there will be one, given the sales numbers 10:56
JJAtria[m] Well, you're about to get a new one 💸
Geth_ doc: hythm7++ created pull request #3696:
Make user aware of the risk of using qqx
11:58
tib Hello again, I'm experiencing very bad performances with unshift (and probably reproducible with prepend), is it "by design" or does it deserves a report (if yes to rakudo ? moarvm ?). It's especially obvious when comparing to "push". 14:04
timotimo can you give us a little benchmark perhaps? and some numbers? 14:05
tib yep
i.imgur.com/Vmk7AnJ.png 14:06
with this code gist.github.com/thibaultduponchell...02a5d1f649 14:08
tib x is number of iterations, and y is seconds. 14:10
timotimo if you'd like to make this better, you could have a look at moarvm's VMArray.c in src/6model/reprs/ 14:11
vmarrays have a start index and length on top of allocated size, and it's meant to handle situations where you mix pushing/unshifting and popping/shifting 14:12
lizmat timotimo: is there a HLL / nqp way to get at these VMArray attributes ? for debugging I mean 14:15
tib timotimo: if I understand correctly, you think that unshift operation is supposed to performs better ? I was wondering if unshift was doing some sort of costly realloc (by design) whereas push is not. 14:16
(In comparison perl 5 has poor perfs but push and unshift seems similar and "stable")
lizmat fwiw, doing the same kind of benchmark with nqp ops, shows it's the nqp::unshift that is causing this, not any HLL issue 14:19
timotimo i think with the debugserver you can read these attributes 14:20
lizmat /* If we don't have room at the beginning of the slots, 14:22
* make some room (8 slots) for unshifting */
so that may be a bit too conservative
lizmat /* We need more slots. If the current slot size is less 14:24
* than 8K, use the larger of twice the current slot size
* or the actual number of elements needed. Otherwise,
* grow the slots to the next multiple of 4096 (0x1000). */
so the other direction it's increasing with 4K increments 14:25
which would explain the difference in performance I guess
timotimo well, 4k after we have 8k elements 14:26
lizmat yeah, which we would get at pretty quickly in that benchmark :-) 14:28
timotimo right
tib Great to see you have an idea on how to improve it :) 14:40
tib lizmat timotimo do you want me to open an issue (I feel not capable for a PR) with bench chart + code snippets ? 14:41
lizmat tib yes please 14:41
in moarvm 14:42
tib ok :)
lizmat thanks!
Geth doc: dumarchie++ created pull request #3698:
Improve documentation of Map.new
15:14
tib rakudo + jvm seems to have a similar behaviour 15:31
Geth doc: da246d0b1d | (Peter du Marchie van Voorthuysen)++ (committed by Juan Julián Merelo Guervós) | doc/Type/Map.pod6
Improve documentation of Map.new

There are two ways to ensure that a literal pair is not interpreted as a named argument. Quoting the key is arguably the clearest.
15:38
linkable6 Link: docs.raku.org/type/Map
cpan-raku New module released to CPAN! Config (3.0.3) by 03TYIL 15:53
guifa Is it possible to pass a capture without needing to slip its values as arguments to another routine? 16:12
guifa e.g. sub foo (|c) { bar |c }; sub bar ($a, $b, $c) { … }; foo 1, 2, 3; 16:12
Directly passing c without the slip will pass it as a literal single argument 16:13
But breaking it down only to reconstruct it feels weird
lizmat m: sub a(|c) { b c }; sub b(\cap) { dd cap }; a 42, :foo
camelia \(42, :foo)
lizmat just pass it along without the prefix |
guifa okay weird 16:15
I swear when I tried this last night I couldn’t deconstruct the capture correctly on the second sub
But I think I was trying to make a sort of anonymous capture doing like sub b(\($a, $b)) or something like that 16:16
thanks lizmat++ 16:19
lizmat m: sub a(|c) { b c }; sub b($cap) { dd @$cap }; a 42, :foo 16:20
camelia (42,)
lizmat note you can just get the positionals or the nameds like that
m: sub a(|c) { b c }; sub b($cap) { dd %$cap }; a 42, :foo
camelia Map.new((:foo))
guifa Yeah. This is kind of a weird situation, I guess. I’m doing method new(|c) { self.bless!actual-new: c } 16:21
because subclasses of Hash don’t have TWEAK or BUILD called
lizmat ah, they don't ? 16:23
that could be considered a bug
probably *is* a bug 16:24
guifa github.com/rakudo/rakudo/issues/2716
lizmat we've had a similar situation with subclasses of Date / DateTime
ah, good point 16:25
guifa Oof, subclassing Date/DateTime. 16:25
I tried that for timezones, not a fun route (mainly because it’s not pervasive)
lizmat so you think the timezone value on DateTime should be a special class, so it can be subclassed? 16:26
rather than just an Int ?
guifa I used an allomorph in my module 16:28
guifa and I return a intstr (or strint or whatever it is) 16:28
[Coke] lizmat: you see the stackoverflow with a hand-rolled cache?
guifa That way stuff just works
lizmat [Coke] ??
guifa: yeah, that should work 16:29
guifa With DateTime at least I managed to do it all via some pretty cool wrapping + mixins. (I’ve got a big advent day post about that)
guifa lizmat: stackoverflow.com/questions/64851261/ 16:31
lizmat are the wrappings and mixins still necessary ?
[Coke] stackoverflow.com/questions/648512...han-python 16:32
[Coke] rants about the old multi-booked meeting problem.
guifa Eh, likely. The problem is when you do math with timezones. Either you subclass (but then break compatibility with other modules) or you do the wraps and mixins 16:33
Honestly though, I have some performance testing, and you take a pretty minimal hit in creating a new DateTime object, and then after that working with them has virtually no perf hit beyond the extra math for calculations 16:34
[Coke] lizmat: I had added a comment about trying the cached/experimental item, it was deleted.
ah. I added an answer, not a comment. fair.
lizmat Yeah, I have no idea why some SO reviewers that do *not* know anything about Raku would do that
Geth doc: dumarchie++ created pull request #3699:
Improve documentation of Hash.push
16:35
lizmat a similar event caused Wendy to give up on SO entirely: it was not nice as a first experience on SO
guifa sticks around on SO for Raku only
[Coke] rewrites it as a comment. 16:41
lizmat [Coke]: using cached does *not* improve that
jmerelo Just a reminder we need the advent calendar articles ASAP, so that we can schedule it without a problem. So submit yours via PR to the advent calendar repo ASAP. 16:46
lizmat notable6: weekly 16:47
notable6 lizmat, No notes for “weekly”
Geth doc: 6ed24973db | (Peter du Marchie van Voorthuysen)++ (committed by Juan Julián Merelo Guervós) | doc/Type/Hash.pod6
Improve documentation of Hash.push

  * correct signature
  * sub push throws if it receives an unexpected named argument
linkable6 Link: docs.raku.org/type/Hash
MasterDuke a profile of that SO code shows 33% of the time spent in GC 16:56
tib MasterDuke even more on my side, 50% 17:00
MasterDuke prob depends on the value for $L. i was using 500_000 17:01
MasterDuke oh, and i'm also on a branch of moarvm i'm working on 17:05
guifa I tried redoing the code using a plain array but my code was taking even longer. But I probably edited it wrongly somewhere 17:09
[Coke] ls 17:18
$%;2~*
cpan-raku New module released to CPAN! Memoize (0.0.7) by 03ELIZABETH 17:26
lizmat and another Rakudo Weekly News hits the Net: rakudoweekly.blog/2020/11/16/2020-...n-renewed/ 19:03
perryprog \o/ 19:06
Looks like some fun weekly challenges too. 19:08
Xliff Hi. If I want to add a :g to a regexp literal, will my $r = m:g/.../ work? 19:54
m: my $a = rule { . } 19:55
camelia ( no output )
Xliff m: my $a = rule { . }; $a.^name.say
camelia Regex
[Coke] m: my $r = / 'a' / ; say "banana" ~~ m:g/ <$r> /; 19:57
camelia (「a」 「a」 「a」)
[Coke] not sure you can put the :g on the $r 19:58
Xliff [Coke]++ -- What you did there is fine, 20:16
guifa looks at weekly (lizmat++) 20:26
guifa hugs vrurg
guifa updates LanguageTag accordingly :D :D
guifa is there any way to use a non-constant as the defined return value in a signature? 20:51
I’m thinking mainly doing something like method foo (—> self) for chaining, but I could see interesting applications if it could be a value createdd/modified in the block 20:52
[Coke] guifa: doesn't work, looks like: 21:00
m: class a { method joe(--> self){"a"} } ; dd a.new.joe
camelia 5===SORRY!5=== Error while compiling <tmp>
Type 'self' is not declared
at <tmp>:1
------> 3class a { method joe(--> self7⏏5){"a"} } ; dd a.new.joe
[Coke] m: class a { method joe(--> 3){"a"} } ; dd a.new.joe
camelia WARNINGS for <tmp>:
Useless use of constant string "a" in sink context (line 1)
3
guifa yeah I know — I didn’t know if there was a way to work around it or if that’s set in stone it’s gotta be a value known at acompile time 21:01
vrurg A code block is actually known at compile time. The problem is that there is no path in compiler code to implement it. 21:11
And no point in actually implementing it as routine body is that block anyway. 21:12