🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). 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 6 September 2022.
Nemokosch Marcool04: the watch issue got resolved by reverting the problematic comment; to-be added to the next release 00:07
avuserow When I'm using nativecall to call a function that mallocs a char* (and define it in raku as `sub foo() returns Str is native("foo") {*}`), it seems this never gets freed by raku. Is there a way to tell raku to take ownership of this Str and free it when it is no longer needed by raku? 03:50
razetime accidents? 04:41
like, road accidents?
Nemokosch avuserow: I would be surprised but this is only my gut feeling 10:48
avuserow @Nemokosch: surprised if this is possible? 13:52
avuserow taking a step back, I'm really just looking for memory management strategies with nativecall using CArray/Str which don't leak 14:02
El_Che good point 14:23
I understand the use case, memory safe languages giving that up for a library feels like a Faustian bargain :) 14:24
if the ecosystem is big enough, I try to avoid library with C code. 14:25
(not the case for raku, atm)
Nemokosch yes, I'd be surprised if this was possible
avuserow Yeah. This is my long-running hobby project of a music player, in which raku is fast enough as the web backend plus glue code. 14:26
El_Che nice 14:28
avuserow Though I'm speed constrained in some areas. For extracting metadata, if I convert from a CArray to a Blob[uint8] for some data, I go from ~1200 files per second to 24 per second. So I'm keeping that as a CArray and then using nativecall to write it to a file.
El_Che understandable
order of magnitude :) 14:29
avuserow I just can't afford to leak ~45kb memory per file across 27000 files
El_Che you'd pay in io time 14:29
Nemokosch almost 2 orders of magnitude 14:31
I mean it's really mindblowing
avuserow I keep the data in a CArray, I can make multiple calls into C/C++ and it's only about 10% slower than doing it in a single C routine 14:34
El_Che that's good 14:35
avuserow if I make some helpers that take CArrays to e.g. do sha256 of the data, or write it to disk, I can still be fast enough while being fairly modular
El_Che nice design 14:36
El_Che starting from real bottlenecks and not beind dogmatic about it 14:36
avuserow this is effectively a version 2 of a project originally written in Perl 5. Raku is forcing me to do things like write efficient SQL queries rather than do a for loop with N select queries :) 14:38
El_Che oh, writing good queries is where the huge gain is in my experience, in all languages :) 14:39
avuserow one of these days I'll make this public but progress is slow due to dayjob, a toddler, and wrist pain. 14:40
El_Che even faster ones :)
avuserow I'm cheating in some places, using postgres to make some of the bigger json responses directly to avoid json serialization in raku
El_Che I have one app in production that had so so queries because the scope was small. Now it's used a lot with lots of new use cases, so I am working on the sql queries atm :)
I wanted to write that app in raku then, but we only had mysql/mariadb at work and no posgres 14:41
now we are introducing posgres as well, but it's still young architecture wise 14:42
El_Che need some work to make the cluster rock stable 14:42
avuserow postgres has lots of goodies, especially if you need json 14:43
I think it also has some nice full text search that I want to play with
and for code re-use, there's also the CTEs (WITH statements) that's on my list to try 14:44
El_Che I try to keep my code db agnostic most of the time, though
but more often that not I end writing raw sqls
and that make it less portabl
e
sadly
avuserow kind of depends in my experience. raw SQL is superficially harder due to quoting. but even with an ORM or SQL builder, you can easily call functions that are non-portable 14:46
El_Che tru
e
Nemokosch anyway, I think it's fairly useful if you report back on what is way too slow in pure Raku
avuserow that's a big motivation of doing this project in raku. basically to see if it's usable (it is), and what that means (issues, shortcuts, etc) 14:49
this is fairly heavy on the glue code aspect though. I'm never planning to do metadata extraction or audio playing directly in Raku so those will always interface with C/C++ 14:50
do we have a JIT for ARM yet? I managed to get this running on a Raspberry Pi 4B so I'm pretty impressed with that aspect of our performance if that's without a JIT 14:53
El_Che no jit
Nemokosch Yeah audio playing is fair. I think we try to compete with languages like JS, Perl or Python performance-wise. Losing somewhat is okay but losing by miles is probably a "show stopper". And playing audio is definitely done by C++ modules on Node as well 14:55
(eww gyp) 14:56
avuserow at least we're fast enough to have a volume slider send websocket commands and change volume real-time over the network. it sounds simple but the latency budget is pretty low here 15:15
this is with my Net::Snapcast module for multiroom audio 15:16
Anton Antonov weekly: rakuforprediction.wordpress.com/20...aku-files/ 15:23
Nemokosch not sure if that bot works from here ^^ 15:29
Anton Antonov <@297037173541175296> Thanks for the prompt ! 15:58
Nemokosch weekly: rakuforprediction.wordpress.com/20...aku-files/ 16:04
Nemokosch um, no avail? 16:05
oh, the bot itself is offline 😆
perhaps there is some IRC issue indeed... 16:07
on Libera
Anton Antonov I am getting this error:
Nemokosch same with kiwiirc
Anton Antonov Ok, thanks for checking!
Ok, thanks for checking / verifying !
Nemokosch Pidgin works but yeah, the bots seem to be offline
Geth doc: usev6++ created pull request #4119:
Minor cleanup to compilation tutorial
16:27
tbrowder m: my $f = "/tmp/t"; sub f(IO::Path:D $f) { slurp $f }; f($f); 17:16
camelia Type check failed in binding to parameter '$f'; expected IO::Path but got Str ("/tmp/t")
in sub f at <tmp> line 1
in block <unit> at <tmp> line 1
tbrowder that's what i expected and want, but i'm not seeing it in a module test, weird, ..., back to the bug hunt... 17:19
guifa huh 18:32
this is weird
so last night I did a test of DateTime::React to test with the timezone roll over
It seems every event only triggered once
and now that I'm testing, it seems that my supplies are just.... silently disappearing? 18:33
strangely though, if I have two separate react blocks, it runs no problem 18:44
thowe So, there's no Net::Server for Raku that I can find... What's the best way to fake it? Specifically looking to run as a server on OpenBSD. 19:05
guifa AHA 19:50
so as much as supply { ……… emit ……… } is a nice looking structure
it's not a live supply 19:51
Nemokosch thowe: what is Net::Server? 😄 20:11
thowe Nemokosch: it wraps your program in a framework to act as a server process on (at least) unix-like machines and handles all the various niceties of being such a thing. metacpan.org/dist/Net-Server/view/...Server.pod 20:31
Net::Daemon is a similar thing 20:33
for Perl 5
Nemokosch What do you want to serve? 20:50
Anton Antonov I want to write / submit a package using the Web service DeepL (see deepl.com). What would be a good or proper name for that package? 1) "WebService::DeepL" , 2) "Lingua::Translation::DeepL::APL" ? 20:52
antononcube I want to write / submit a package using the Web service DeepL (see deepl.com/). What would be a good or proper name for that package? 1) "WebService::DeepL" , 2) "Lingua::Translation::DeepL::APL" ? 20:59
Xliff guifa: It isn't? 21:12
japhb: Around?
guifa Xliff: it is't. It's an on-demand one
Anton Antonov I want to write / submit a package using the Web service DeepL (see deepl.com). What would be a good or proper name for that package? 1) "WebService::DeepL" , 2) "Lingua::Translation::DeepL::API" ? 21:13
Xliff Can't you do: my $s = do suppy { ... emit ... }; $s.Suppy.tap(...) ? 21:14
antononcube I meant "Lingua::Translation::DeepL::API" (not "Lingua::Translation::DeepL::APL".)
Xliff Wow. That indeed does not work. 21:16
Xliff antononcube: WebService::DeepL is fine, but Lingua::Translatiion::DeepL is probably better 21:19
antononcube Xliff Ok -- thank you for your feedback! 21:21
Geth doc: 9a9359d5b6 | (Christian Bartolomäus)++ (committed using GitHub Web editor) | doc/Language/compilation.pod6
Minor cleanup to compilation tutorial (#4119)
21:45
linkable6 Link: docs.raku.org/language/compilation