00:00:05 | * | disso-peach quit (Quit: Leaving) |
00:00:12 | * | albe quit (Quit: The Lounge - https://thelounge.chat) |
00:07:19 | * | albe joined #nim |
02:00:38 | FromDiscord | <Nlits (Ping on reply)> Are seqs and strings still stored on the heap |
02:00:48 | FromDiscord | <Elegantbeef> Of course |
02:02:14 | FromDiscord | <Nlits (Ping on reply)> In reply to @Elegantbeef "Of course": So then sizeof(string) should be all i need to allocate for a string, since the actual data is stored elsewhere, correct? |
02:02:35 | FromDiscord | <Elegantbeef> Yes |
02:19:53 | FromDiscord | <Nlits (Ping on reply)> And finally, would i need to manually share the stored data to share it between threads? It seems there is no easy way to create a sharedAlloc string |
02:20:11 | FromDiscord | <Nlits (Ping on reply)> If yes, how |
02:23:53 | FromDiscord | <Elegantbeef> Pass it as a parameter to a thread |
02:24:02 | FromDiscord | <Elegantbeef> Make it a global variable and `{.gcsafe.}: ...` it |
02:24:12 | FromDiscord | <Elegantbeef> Pass it across a channel using `ptr string` |
02:25:41 | FromDiscord | <Elegantbeef> You do not even need `sharedAlloc` if you ensure the string outlives the threads |
02:32:36 | FromDiscord | <Nlits (Ping on reply)> In reply to @Elegantbeef "Pass it across a": Hm for some reason i thought channels were deprecated. (The string doesn't outlive the thread and is deeply embedded in a object, making things more difficult) |
03:12:02 | FromDiscord | <illum1nation> what hashing algorithm does std/hash use? I could'nt find it in the docs |
03:12:12 | FromDiscord | <illum1nation> (edit) "std/hash" => "std/hashes" |
03:19:35 | FromDiscord | <Elegantbeef> It's an implementation detail, but seems it's wangyi hash and murmurhash |
03:21:20 | * | SchweinDeBurg quit (Quit: WeeChat 4.5.0-dev) |
03:27:19 | * | SchweinDeBurg joined #nim |
04:08:59 | FromDiscord | <xtrayambak> In reply to @demotomohiro "How about to this?": I actually have casted a `Function` into a `Scope` and want to turn it back into a `Function`, but that results in the `name` string's length becoming a big integer and accessing the `name` string causes a segmentation fault |
04:09:03 | FromDiscord | <xtrayambak> but again, I was using `cast` |
04:09:18 | FromDiscord | <xtrayambak> doing `Function(myScope)` causes a conversion defect |
04:10:50 | FromDiscord | <Elegantbeef> I really should make a PR that on first install if Nim detects `cast` in user code you have to agree to a "I understand that `cast` is an unsafe operation that retinterprets bits and will not abuse it" 😄 |
04:35:20 | * | rockcavera quit (Remote host closed the connection) |
04:59:39 | FromDiscord | <demotomohiro> In reply to @xtrayambak "I actually have casted": Use `cast` only when you know the data structure of variables and how memory management works.↵`cast` just copys bits and it doesn't copy safely any variables. |
04:59:50 | FromDiscord | <xtrayambak> In reply to @demotomohiro "Use `cast` only when": ah |
05:00:16 | FromDiscord | <xtrayambak> In reply to @Elegantbeef "I really should make": yeah, that was probably stupid on my part |
05:10:04 | FromDiscord | <demotomohiro> sent a long message, see https://pasty.ee/rTKHLjty |
05:12:15 | FromDiscord | <Elegantbeef> You'd think demo, but people cannot read |
05:12:23 | FromDiscord | <Elegantbeef> They see `cast` and go "Oh I want to convert types" |
05:13:57 | FromDiscord | <demotomohiro> hmm |
05:23:05 | FromDiscord | <Elegantbeef> I might be too jaded and cynical |
06:29:13 | * | PMunch joined #nim |
06:37:01 | FromDiscord | <nnsee> might be? that's surprisingly optimistic of you |
06:39:05 | FromDiscord | <Elegantbeef> I do always like to downplay reality |
07:46:39 | FromDiscord | <Robyn [She/Her]> How would I go about making workers in Nim? I want to have a queue of available worker threads that I pass work to when they're available, but I don't want to wake up the thread as work is available, not sure how exactly to do that |
07:47:57 | FromDiscord | <Elegantbeef> Use a channel |
07:48:04 | FromDiscord | <Elegantbeef> Use selectors |
07:48:33 | FromDiscord | <Robyn [She/Her]> i want to wake up the thread i mean |
07:48:51 | FromDiscord | <Elegantbeef> Right so you do `let data = channel.recv()` |
07:49:05 | FromDiscord | <Elegantbeef> `recv` is blocking |
07:49:54 | FromDiscord | <Elegantbeef> You can just use a threadpool though |
07:50:04 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "`recv` is blocking": Oooh okay, rad |
07:53:10 | * | HER_ joined #nim |
07:55:00 | * | HER quit (Ping timeout: 252 seconds) |
07:55:49 | * | redj quit (Quit: No Ping reply in 180 seconds.) |
07:57:16 | * | redj joined #nim |
08:05:12 | * | jjido joined #nim |
08:53:21 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
09:18:00 | * | cnx quit (Remote host closed the connection) |
09:26:50 | * | cnx joined #nim |
09:31:10 | * | coldfeet joined #nim |
10:15:24 | * | coldfeet quit (Remote host closed the connection) |
11:43:25 | * | ryuukk quit (Remote host closed the connection) |
11:44:23 | * | ryuukk joined #nim |
12:04:30 | FromDiscord | <nocturn9x> What is the simplest, cross-platform way for me to have threads wait on a semaphore? |
12:04:45 | FromDiscord | <nocturn9x> I'm trying to keep worker threads around instead of creating them every time, and sleeping on a semaphore seems like the way to go |
12:04:54 | FromDiscord | <nocturn9x> or a condition variable, whatever works |
12:20:56 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=bCajEYZy |
12:21:25 | FromDiscord | <nocturn9x> `self.children[i]` is a big `ref object` and I can't afford to not use it in the main thread (all shared state is accessed through atomics and is therefore safe): how do I make nim shut up? |
12:23:06 | FromDiscord | <griffith1deadly> In reply to @nocturn9x "`self.children[i]` is a big": unsafeIsolate exists |
12:23:24 | FromDiscord | <nocturn9x> how do I use it though? |
12:24:02 | FromDiscord | <nocturn9x> I don't control `threadpools`' code |
12:24:05 | FromDiscord | <nocturn9x> so I can't just go and change it |
12:24:38 | FromDiscord | <nocturn9x> it seems the problem is with `toTask()` |
12:27:57 | FromDiscord | <nocturn9x> I can get around it by storing the reference somewhere else and then letting the thread access that, but it's kind of ugly |
12:28:38 | FromDiscord | <griffith1deadly> seems like thats only possible way |
12:34:15 | * | ryuukk quit (Remote host closed the connection) |
12:36:32 | * | ryuukk joined #nim |
12:37:55 | * | ntat joined #nim |
13:00:34 | FromDiscord | <nocturn9x> _Spawns the input function call asynchronously, potentially on another thread of execution._↵what the fuck do you mean potentially↵the fuck is the point of a library called threadpools if it only potentially spawns different threads↵I stg sometimes Nim makes me want to kill someone. |
13:00:41 | FromDiscord | <nocturn9x> (edit) "potentially" => "_potentially_" |
13:01:17 | FromDiscord | <nocturn9x> I want it to _always_ start a new thread |
13:03:06 | FromDiscord | <nocturn9x> and I want it to be immediate, too. From my testing it seems that `spawn` does not actually immediately create a task |
13:03:08 | FromDiscord | <nocturn9x> that is a big problem |
13:04:37 | FromDiscord | <odexine> if the current thread is idle then why would it need to use another thread, or perhaps it means that itll reuse an idle thread thats been spawned already |
13:06:23 | FromDiscord | <nocturn9x> the current thread is most definitely _not_ idle |
13:06:30 | FromDiscord | <nocturn9x> since it spawns stuff then goes on to do work on its own |
13:06:39 | FromDiscord | <nocturn9x> the problem is that it seems spawning is done lazily |
13:06:46 | FromDiscord | <nocturn9x> until you sync on something or call syncAll |
13:06:50 | FromDiscord | <nocturn9x> that is _not_ okay |
13:06:56 | FromDiscord | <nocturn9x> I need the worker to start when I say so |
13:07:21 | FromDiscord | <nocturn9x> because if I have the thread argument set to, say, 5, then I spawn 4 workers and do the same work on the thread that created the pool |
13:07:30 | FromDiscord | <nocturn9x> because this is how SMP is generally implemented in chess engines |
13:07:38 | FromDiscord | <nocturn9x> this doesn't work if the workers start _after_ main search is done |
13:09:05 | FromDiscord | <nocturn9x> anyway, whatever, this is just a sign that threading in Nim is still as garbage as I remember it to be |
13:09:09 | FromDiscord | <nocturn9x> (edit) "remember" => "remembered" |
13:09:31 | FromDiscord | <nocturn9x> there is not _one_ simple library that implements a basic `Event` with `set`/`wait`, seemingly for no reason |
13:09:40 | FromDiscord | <nocturn9x> might just make one myself at that point |
13:50:20 | FromDiscord | <nervecenter> You should probably have this talk with Araq in #internals |
13:50:43 | FromDiscord | <nervecenter> In reply to @nocturn9x "_Spawns the input function": You should probably have this talk with Araq in #internals |
13:59:57 | * | beholders_eye joined #nim |
14:01:21 | * | acidsys quit (Ping timeout: 248 seconds) |
14:02:22 | FromDiscord | <narimiran> Who wants a new Nim release?↵↵Here, have two: https://nim-lang.org/blog/2024/10/02/nim-220-2010.html |
14:11:56 | * | PMunch quit (Quit: Leaving) |
14:20:15 | * | ryuukk quit (Remote host closed the connection) |
14:21:58 | * | ryuukk joined #nim |
14:25:55 | * | acidsys joined #nim |
14:29:11 | FromDiscord | <fabric.input_output> > ↵> ↵> Methods now support implementations based on a VTable by using --experimental:vtables. Methods are then confined to the same module where their type has been defined.↵💪 yay |
14:29:16 | FromDiscord | <kiloneie> I saw this when i was in the bathroom, then i forgot about it till i saw announcement post.↵↵Where do i post FORUM issues ? |
14:29:24 | FromDiscord | <kiloneie> under website ? |
14:29:25 | FromDiscord | <fabric.input_output> (edit) removed "↵> ↵>" |
14:32:21 | FromDiscord | <spotlightkid> https://github.com/nim-lang/nimforum/issues |
14:57:31 | * | coldfeet joined #nim |
15:22:49 | * | lucasta joined #nim |
15:29:41 | FromDiscord | <kiloneie> Man... there is no difference between Farm and the previous... https://media.discordapp.net/attachments/371759389889003532/1291059540724289637/image.png?ex=66feb865&is=66fd66e5&hm=3b24ed1ecce3bbfb1f1e61d01a085d663561e6ba81372c76b6c8dc5dd60f6899& |
15:29:54 | FromDiscord | <kiloneie> Bad benchmark ? |
15:42:28 | FromDiscord | <kiloneie> Wait, this has to be because im using a 16bit int instead of what Farm can do, a 64bit string Hash ? |
15:43:34 | FromDiscord | <odexine> farm is not going to improve performance for hashing a 16 bit int |
15:43:46 | FromDiscord | <odexine> hashing a 16 bit int is already unnecessary |
15:43:57 | FromDiscord | <kiloneie> Does choosenim allow you to have multiple Nim versions for such testings ? I always do a manual install. |
15:44:14 | FromDiscord | <odexine> iirc yes? |
15:44:18 | FromDiscord | <odexine> just switch between them |
15:44:36 | FromDiscord | <kiloneie> wait i can just ". Define nimStringHash2 to get the old values back." right ? |
15:46:17 | FromDiscord | <kiloneie> "std/hashes.hash(x:string) changed to produce a 64-bit string Hash", is this just for 64bit strings then ?... im confused |
16:32:42 | FromDiscord | <jmgomez> ' |
16:36:52 | FromDiscord | <fabric.input_output> so now hashes are 64 bit? |
16:37:15 | FromDiscord | <fabric.input_output> cuz until now it was `type Hash = distinct uint32` or smth |
16:45:06 | FromDiscord | <kiloneie> https://github.com/nim-lang/Nim/blob/version-2-0/lib/pure/collections/sets.nim↵I think only the algorithm has changed to Farm-like. |
16:45:21 | FromDiscord | <kiloneie> im not that good with github yet... |
16:48:41 | * | lucasta quit (Remote host closed the connection) |
17:15:16 | * | coldfeet quit (Remote host closed the connection) |
17:56:54 | FromDiscord | <rakgew> iirc the typical farm hash result is a uint64 |
17:59:43 | FromDiscord | <spotlightkid> Yes, that is the point of choosenim. But only one version can be active at any one time. It is not like e.g. pyenv, where you can set different Python version for different projects or just for the active shell.↵(@kiloneie) |
18:16:49 | FromDiscord | <kiloneie> so i can do something like choosenim 2.0.8, it downloads it(or i have to b4 hand), and then compile, and redo for 2.2.0, right ? |
18:19:10 | FromDiscord | <griffith1deadly> choosenim 2.0.8↵nim -v↵choosenim 2.2.0↵nim -v |
18:20:41 | FromDiscord | <kiloneie> And choosenim can self update right ? |
18:22:15 | * | ntat quit (Quit: Leaving) |
18:52:51 | * | jjido joined #nim |
18:57:17 | FromDiscord | <double_spiral> In reply to @narimiran "Who wants a new": bro chill im still on 2.0.6 |
19:12:50 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
19:13:01 | FromDiscord | <rakgew> for nim2.2.0 I thought I try out choosenim, but no luck so far\:↵anyone else has problems running latest choosenim on debian(12/bookworm)?↵it does compile, but when run I get the error `could not load: libcurl.so(|.4)` even though I have the dependency `libcurl4-gnutls-dev` installed as mentioned in the readme and issue #303 |
19:14:37 | FromDiscord | <rakgew> ah? the debug build runs? weird |
19:17:03 | FromDiscord | <rakgew> ok, without `-d:staticBuild` it works. \:-D |
19:47:43 | FromDiscord | <silme94> can we use tlHelp32.h functions in nim? if yes how |
19:48:00 | FromDiscord | <silme94> like CreateToolhelp32Snapshoot |
20:17:47 | FromDiscord | <Nlits (Ping on reply)> What is the best way to pass priority in a async? I have something i want to check every cycle, and am currently using sleepAsync but that hangs. I understand running checks until isn't a very efficient or async thing to do but i don't really have any options in my current situation |
20:23:26 | FromDiscord | <enthus1ast.> Maybe fulfill a promise? |
20:25:47 | FromDiscord | <Nlits (Ping on reply)> In reply to @enthus1ast. "Maybe fulfill a promise?": If done in a while loop it overwhelms async resulting in a block (It creates a new promise before async goes and resolves a different one) |
20:26:20 | FromDiscord | <enthus1ast.> What do you mean by cycle? |
20:27:59 | FromDiscord | <enthus1ast.> And sleepAsync is designed to "hang" |
20:28:18 | FromDiscord | <enthus1ast.> Maybe there is a fundamental misunderstanding? |
20:30:09 | FromDiscord | <enthus1ast.> What I sometimes did was asyncCheck a proc which had an endless loop doing something and await sleepAsync |
20:32:44 | FromDiscord | <enthus1ast.> But I do not use async any more (or quite seldom) for instances where I need similar functionality I used a simple hack like this: ↵↵https://github.com/enthus1ast/nimRunEngine↵https://github.com/enthus1ast/nimIntervalEngine |
20:33:45 | FromDiscord | <enthus1ast.> The two functions above let me remove all async code I had |
20:33:58 | FromDiscord | <Nlits (Ping on reply)> In reply to @enthus1ast. "And sleepAsync is designed": That was a separate issue i accidentally mixed in there where my code was hanging forever |
20:34:02 | FromDiscord | <enthus1ast.> (edit) "functions" => "modules" |
20:46:01 | * | beholders_eye quit (Read error: Connection reset by peer) |
20:47:37 | FromDiscord | <Nlits (Ping on reply)> In reply to @enthus1ast. "What do you mean": I need it to check often, but not often to block other tasks |
20:47:42 | FromDiscord | <Nlits (Ping on reply)> Would poll work? |
20:49:57 | FromDiscord | <Nlits (Ping on reply)> poll seems to work |
21:12:52 | FromDiscord | <Nlits (Ping on reply)> Update: i created a new, better wait for cycle function, but now i still have the issue where sleepAsync hangs forever. (With prologue) |
21:14:32 | * | om3ga quit (Ping timeout: 255 seconds) |
21:20:02 | FromDiscord | <Nlits (Ping on reply)> I managed to fix the problem by creating a loop on every thread, but a solution where I can run it on the main thread would be helpful |
21:27:10 | * | HER_ is now known as HER |
21:32:23 | FromDiscord | <enthus1ast.> Why not just spawn a thread? |
21:32:44 | FromDiscord | <enthus1ast.> Then lock the stuff you need to access and call it a day 🙂 ? |
22:04:30 | FromDiscord | <Nlits (Ping on reply)> In reply to @enthus1ast. "Why not just spawn": Idk how prologue handles threads and how to safely spawn one |
23:36:27 | FromDiscord | <spotlightkid> Yes, but if you have choosenim \<= 0.8.4 installed, don't use `choosenim update self`, because choosenim's repo moved moved from \>= 0.8.5. So you need to re-install it from https://github.com/nim-lang/choosenim |
23:37:01 | FromDiscord | <spotlightkid> Yes, but if you have choosenim \<= 0.8.4 installed, don't use `choosenim update self`, because choosenim's repo moved moved from \>= 0.8.5. So you need to re-install it from https://github.com/nim-lang/choosenim↵(@kiloneie) |
23:40:33 | FromDiscord | <kiloneie> Okay. I haven't had a choosenim for more than a test try years ago so no problems there. |
23:51:32 | * | fallback quit (Read error: Connection reset by peer) |