00:07:52 | * | noeontheend joined #nim |
00:20:47 | * | ltriant quit (Read error: Connection reset by peer) |
00:26:03 | * | ltriant joined #nim |
00:27:18 | * | noeontheend quit (Ping timeout: 268 seconds) |
01:07:23 | * | SamuelMarks quit (Ping timeout: 268 seconds) |
01:11:07 | * | vicfred quit (Quit: Leaving) |
01:20:39 | * | neurocyte8614492 quit (Ping timeout: 246 seconds) |
01:55:42 | * | SamuelMarks joined #nim |
02:02:39 | * | SamuelMarks quit (Ping timeout: 246 seconds) |
02:09:44 | * | adigitoleo joined #nim |
02:11:10 | * | arkurious quit (Quit: Leaving) |
02:12:36 | adigitoleo | Hi, I'm missing something simple here, any idea why toHex is different the second time? https://x0.at/JT1O.txt |
02:16:20 | FromDiscord | <Elegantbeef> Can you post the code here? https://play.nim-lang.org/ |
02:17:05 | FromDiscord | <huantian> I got you beef https://play.nim-lang.org/#ix=3UEU |
02:19:30 | adigitoleo | Aha, it works when I join strings with the slash already in them: https://play.nim-lang.org/#ix=3UEV |
02:20:18 | FromDiscord | <Elegantbeef> Well what it's' outputting is `\17\0\26` they're not escaped characters |
02:21:13 | adigitoleo | yeah I think I got it now, have to escape properly |
02:21:42 | FromDiscord | <Elegantbeef> or just turn it into a `char` `[17.char, 0.char, 26.char]` |
02:22:04 | FromDiscord | <Elegantbeef> which is just \`['\\17', '\\0', '\\26']\`\` |
02:29:09 | * | SamuelMarks joined #nim |
02:37:19 | * | SamuelMarks quit (Ping timeout: 256 seconds) |
03:02:45 | FromDiscord | <TryAngle> can I call nimscripts from bash? |
03:02:54 | FromDiscord | <TryAngle> (edit) "nimscripts" => "scripts written in nim" |
03:03:37 | FromDiscord | <TryAngle> (edit) "bash?" => "shell script?" |
03:03:45 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/nims.html standalone nimscript |
03:05:03 | FromDiscord | <huantian> wow that edit died |
03:06:39 | FromDiscord | <TryAngle> In reply to @Elegantbeef "https://nim-lang.org/docs/nims.html standalone nims": looks good but can I also use normal nim files? |
03:06:51 | FromDiscord | <TryAngle> (edit) "In reply to @Elegantbeef "https://nim-lang.org/docs/nims.html standalone nims": looks good ... but" added "enough" |
03:06:54 | FromDiscord | <Elegantbeef> think so |
03:06:57 | FromDiscord | <Elegantbeef> Dont recall |
03:07:00 | FromDiscord | <Elegantbeef> there is also nimcr |
03:07:07 | FromDiscord | <TryAngle> because there is always a binary generated |
03:07:09 | FromDiscord | <demotomohiro> You can import .nim files from .nims |
03:12:34 | FromDiscord | <demotomohiro> Running standalone nim script doesn't generage binary files |
03:12:59 | FromDiscord | <Elegantbeef> Even if there is just do `nim r` and you dont have the binary |
03:13:12 | FromDiscord | <TryAngle> ah true I forgot about nim r |
03:13:45 | FromDiscord | <TryAngle> so If I want to write scripts for example my window manager I could just nim r <script>? |
03:14:48 | FromDiscord | <huantian> or use a shebang |
03:15:07 | FromDiscord | <Elegantbeef> May want to look at nimcr |
03:15:29 | FromDiscord | <demotomohiro> Actually nim r generate c and object files in nimcache. |
03:15:43 | FromDiscord | <Elegantbeef> Who said it didnt? |
03:16:08 | FromDiscord | <Elegantbeef> `nim r` doesnt have the binary in the directory is my point |
03:16:14 | FromDiscord | <demotomohiro> Ol |
03:16:17 | FromDiscord | <demotomohiro> Ok |
03:17:20 | FromDiscord | <TryAngle> In reply to @Elegantbeef "`nim r` doesnt have": yeye, tha'ts also the only thing I was looking for |
04:04:27 | FromDiscord | <huantian> Can I get testament to disable a test on everything but windows? |
04:05:06 | FromDiscord | <Elegantbeef> still with the CI issues? |
04:05:40 | FromDiscord | <huantian> at this point I've just given up and made a seperate test file for win and `include`d the other file \:P |
04:06:18 | FromDiscord | <Elegantbeef> Maybe flywind can help |
04:07:31 | FromDiscord | <xflywind> IMO it is to be implemented, I would use when defined(windows) atm. |
04:08:54 | FromDiscord | <huantian> last time I checked when didn't work with the testament spec |
04:11:05 | NimEventer | New thread by Jwatson-CO-edu: Creation of Variant Types with Table Members, see https://forum.nim-lang.org/t/9093 |
04:11:49 | FromDiscord | <huantian> context is trying to get the test for https://github.com/nim-lang/Nim/pull/19622 work on windows, since it uses backslashes |
04:12:56 | FromDiscord | <huantian> The easy way out would just be to not touch the test and just change the message \:P |
04:13:08 | * | toulene quit (Read error: Connection reset by peer) |
04:13:46 | * | toulene joined #nim |
04:15:19 | FromDiscord | <Elegantbeef> Flywind i do have to ask if you're going to document the `fromJson` possibly having a dangling pointer |
04:20:15 | FromDiscord | <xflywind> In reply to @Elegantbeef "Flywind i do have": You have the better understanding of the issue. I would appreciate it if you could docuemdocument it. |
04:21:34 | FromDiscord | <Elegantbeef> I guess to me there is the question of "should it even be supported" |
04:23:48 | FromDiscord | <Elegantbeef> Deserializing a `cstring` is just such a silly thing to do without doing `create(char, json.str.len)` |
04:24:54 | FromDiscord | <xflywind> yeah |
04:25:44 | FromDiscord | <Elegantbeef> As such i'd argue just removing the branch |
04:25:59 | FromDiscord | <Elegantbeef> If you want to serialize a `cstring` do it yourself |
04:28:03 | FromDiscord | <xflywind> In reply to @huantian "context is trying to": I think disabling windows is good enough for tests. The error message doesn't seem to be platform specific. |
04:31:12 | FromDiscord | <huantian> Ok cool that seems good |
04:32:43 | FromDiscord | <xflywind> Or if you can utilize `tests/misctrunner` and check the output. |
04:32:48 | FromDiscord | <xflywind> (edit) "`tests/misctrunner`" => "`tests/misc/trunner`" |
04:35:04 | * | zeus-supreme joined #nim |
04:35:12 | FromDiscord | <xflywind> sent a code paste, see https://play.nim-lang.org/#ix=3UF8 |
04:35:54 | FromDiscord | <Valdar> What am I doing wrong here:↵`if (stbi_info(fullName.cstring,width,height, n)) != 1:`↵` raise newException(IOError, "Cannot open file")`↵I still get "Error: unhandled exception:" Shouldn't that 'handle' it? |
04:36:43 | FromDiscord | <Elegantbeef> There is nothing handling an exception there |
04:36:47 | FromDiscord | <Elegantbeef> `try` handles exceptions |
04:37:49 | * | zeus-supreme1 quit (Read error: Connection reset by peer) |
04:37:57 | FromDiscord | <Valdar> ok, I tried try (no pun intended) and got the same. I was looking at code on Github and I don't see try used much |
04:38:06 | * | slowButPresent quit (Quit: leaving) |
04:38:16 | FromDiscord | <Valdar> what does raise do then? |
04:38:59 | FromDiscord | <Elegantbeef> raises an exception |
04:39:00 | FromDiscord | <Elegantbeef> try\: |
04:39:10 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UF9 |
04:42:25 | FromDiscord | <huantian> hm maybe I'll try this↵(@xflywind) |
04:45:01 | FromDiscord | <huantian> haven't seen this before |
04:51:05 | FromDiscord | <xflywind> It should have been documented in https://nim-lang.github.io/Nim/contributing.html |
04:58:29 | FromDiscord | <huantian> documentation? for the weak |
05:18:06 | * | SamuelMarks joined #nim |
05:22:33 | * | SamuelMarks quit (Ping timeout: 248 seconds) |
05:23:38 | * | yoyojambo joined #nim |
05:24:29 | yoyojambo | how much memory does a boolean ocupy? |
05:24:44 | yoyojambo | like if I had a sequence of booleans that is |
05:25:36 | FromDiscord | <Elegantbeef> 1 byte per bool |
05:25:48 | FromDiscord | <Elegantbeef> Depending what you're doing you can just use a `set[T]` |
05:25:51 | FromDiscord | <Elegantbeef> What're you doing?! |
05:25:56 | FromDiscord | <yoyojambo> damn a whole byte? |
05:26:14 | yoyojambo | i was planning on creating a matrix of booleans |
05:26:18 | FromDiscord | <Elegantbeef> Yea nim doesnt do a bitseq for `seq[bool]` |
05:26:29 | FromDiscord | <Elegantbeef> C++ does that and it's a mistake |
05:26:36 | FromDiscord | <Elegantbeef> it requires all logic to specialize for bool so it's dumb |
05:26:44 | FromDiscord | <Elegantbeef> "matrix of booleans"? |
05:26:48 | FromDiscord | <Elegantbeef> Is that just flags? |
05:27:05 | yoyojambo | I mean like a sequence of sequences of booleans |
05:27:11 | yoyojambo | like a 2d sequence |
05:27:32 | yoyojambo | wdym flags? |
05:27:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/TiL |
05:28:05 | FromDiscord | <Elegantbeef> How big does this need to be and are these named? |
05:28:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UFj |
05:30:16 | yoyojambo | hmmm I'm not sure I follow what you're saying |
05:30:37 | FromDiscord | <Elegantbeef> What is this for? |
05:30:57 | FromDiscord | <Elegantbeef> What are these bools for, is my point |
05:31:02 | FromDiscord | <Elegantbeef> my question rather 😄 |
05:31:14 | yoyojambo | ahh |
05:31:30 | yoyojambo | it represents cells in the Game of Life |
05:31:40 | yoyojambo | Conway's Game of Life |
05:32:03 | yoyojambo | its supposed to be a slice of the actual thing |
05:32:49 | yoyojambo | but I will save the actual cells as a seq of coordinates, and just make a 2d sequence of actual cells to compute the next gen |
05:32:59 | FromDiscord | <Elegantbeef> Well if the size is fixed or within `0..uint16.high` you could use a `seq[set[0..high]]` otherwise you need a bitvector |
05:33:45 | yoyojambo | it is not fixed |
05:34:05 | FromDiscord | <Elegantbeef> is the width of 65k to few? |
05:34:50 | FromDiscord | <Elegantbeef> https://github.com/treeform/bitty/ this does exist |
05:35:22 | yoyojambo | that could be very useful actually |
05:35:26 | yoyojambo | thanks |
05:35:56 | yoyojambo | because I could just make it so that it never calls for a big matrix |
05:35:59 | FromDiscord | <Elegantbeef> @treeform\: is there a reason you make your types `ref object` instead of just `type MyType {.byref.} = object`? |
05:36:19 | yoyojambo | but I just wanted to know how fast it would be too ridiculously big |
05:38:12 | yoyojambo | because the actual coordinates are represented with BiggestInt so if i accidentally asked for a range that covered a really big area it would make a reaaaaaaly big array |
05:38:28 | FromDiscord | <Elegantbeef> Ah disregard this, you use it for aliasing performance |
05:41:19 | FromDiscord | <Valdar> Thx Beef, I found the issue with catching the error |
05:41:29 | FromDiscord | <Elegantbeef> Congrats |
05:41:52 | FromDiscord | <Elegantbeef> What was the issue? |
05:42:40 | * | rockcavera quit (Remote host closed the connection) |
05:42:43 | FromDiscord | <Valdar> My stupidity 🙂 |
05:43:00 | FromDiscord | <Elegantbeef> PEBKAC is always the worsr |
05:43:53 | FromDiscord | <treeform> In reply to @Elegantbeef "<@107140179025735680>\: is there a": I don't know what that {.byref.} even does? |
05:44:06 | FromDiscord | <Valdar> The error was actually about 4 lines above where I was trying to fix it. I was tapping the file twice and I wasn't paying attention to the line number in there error mesg |
05:44:06 | FromDiscord | <treeform> ref object is what nim uses? |
05:44:09 | FromDiscord | <Elegantbeef> it makes all procedures take a reference to the object |
05:45:08 | FromDiscord | <treeform> what is the benefit of using {.byref.} vs ref object? |
05:45:41 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/nGg |
05:45:53 | FromDiscord | <Elegantbeef> If it's for aliasing there is no benefit |
05:46:11 | FromDiscord | <Elegantbeef> If it's for ensuring the object is always passed as a reference to procedures it means you dont introduce nil semantics |
05:46:34 | FromDiscord | <Hamid_Bluri> wow |
05:46:45 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/1oA |
05:47:39 | FromDiscord | <Elegantbeef> Wow what? |
05:47:53 | FromDiscord | <Hamid_Bluri> > it means you dont introduce nil semantics |
05:48:28 | FromDiscord | <Elegantbeef> I dont know why treeform uses `ref object` so no clue if it's actually an improvement |
05:48:53 | FromDiscord | <treeform> ref object are usually faster then objects because less copies |
05:49:04 | FromDiscord | <Elegantbeef> That's not true |
05:49:32 | FromDiscord | <treeform> unless object is very small |
05:49:34 | FromDiscord | <Elegantbeef> Nim optimises procedure passing based off size, and also move semantics means moves are done instead of copies where needed |
05:49:58 | FromDiscord | <treeform> not in my experience |
05:50:12 | FromDiscord | <treeform> compiler is really bad at removing copies and I must help it. |
05:50:19 | FromDiscord | <Elegantbeef> With arc/orc? |
05:50:23 | FromDiscord | <Elegantbeef> Or with refc? |
05:50:26 | FromDiscord | <demotomohiro> Sizeof(BitArray) would be small enough so pass by copy would be fine. |
05:50:40 | FromDiscord | <treeform> I think most of my experience is with refc |
05:50:42 | FromDiscord | <Hamid_Bluri> sent a long message, see https://paste.rs/264 |
05:51:12 | FromDiscord | <Elegantbeef> Ah then there you go, we use two different runtimes mostly 😄 |
05:51:41 | FromDiscord | <Hamid_Bluri> " different runtimes "? |
05:51:57 | FromDiscord | <Elegantbeef> the RC and refc behave differently |
05:52:18 | FromDiscord | <Elegantbeef> Orc/arc have movesemantics so some things are completely free |
05:52:54 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UFn |
05:53:26 | yoyojambo | I know that there is some cool stuff about arc/orc, but what are the benefits of refc? Like what does it do better? |
05:53:27 | FromDiscord | <treeform> I mainly use ref object because its easier as well |
05:53:37 | FromDiscord | <treeform> if you use plain object now you got to var it everywhere |
05:53:41 | FromDiscord | <Elegantbeef> Well it also makes your code slower |
05:53:52 | FromDiscord | <treeform> and make sure you baby them about because they are mostly copies |
05:54:23 | FromDiscord | <treeform> in my experience plain object are just too much tourble |
05:54:26 | FromDiscord | <treeform> (edit) "tourble" => "trouble" |
05:54:32 | FromDiscord | <treeform> and make code slow |
05:54:32 | FromDiscord | <Elegantbeef> You now have a pointer indirection for the sequence so you now really destroy your cache |
05:55:30 | FromDiscord | <treeform> If an object contains a seq it might accidently trash your perf |
05:55:40 | FromDiscord | <treeform> because it not only copies the object but also the seq |
05:56:20 | FromDiscord | <Hamid_Bluri> In reply to @yoyojambo "I know that there": araq had a talk about it in 2020 i guess↵the archive is available in nim youtube channel |
05:56:21 | FromDiscord | <treeform> if you can prove that you can speed up our code with objects we will take the PRs |
05:56:58 | FromDiscord | <treeform> main benefits of refc is that it had less bugs. |
05:57:11 | FromDiscord | <treeform> but arc/orc is pretty good |
05:57:22 | FromDiscord | <treeform> just waiting for it to be the default really |
05:57:29 | FromDiscord | <Elegantbeef> But anyway you said your piece and i understand i'll shush now |
05:57:29 | FromDiscord | <Elegantbeef> You now have the indirection of `mydata` then indirection of `bitseq` then finally indirection of that seq's data |
05:57:30 | FromDiscord | <Elegantbeef> You've really throttled the cache now |
05:57:30 | FromDiscord | <Elegantbeef> peace rather 😄 |
05:57:31 | yoyojambo | thanks Hamid I'll check it out |
05:57:32 | FromDiscord | <Elegantbeef> Arc/orc will make some of your usages of `ref object` deprecated though 😄 |
05:57:33 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UFo |
05:57:49 | FromDiscord | <Elegantbeef> Oh boy did matrix crash 😄 |
05:58:26 | FromDiscord | <treeform> I love making things fast. If you can speed up any of my code's hot paths, PRs welcome. |
05:58:37 | FromDiscord | <treeform> Its not like I love "ref objects" |
05:58:46 | FromDiscord | <treeform> if shown some thing be faster i'll use |
05:58:58 | FromDiscord | <treeform> just not on toy examples |
05:59:28 | FromDiscord | <treeform> most code is not hot paths, so it really does not matter |
05:59:48 | FromDiscord | <treeform> but were it matters, I am interested |
05:59:49 | * | adigitoleo left #nim (#nim) |
06:00:13 | yoyojambo | wdym hot paths? like stuff that makes a lot of changes to data? |
06:00:30 | FromDiscord | <Elegantbeef> hot paths are paths in the code that are often taken |
06:00:51 | FromDiscord | <treeform> its here you should optimize |
06:00:55 | FromDiscord | <Elegantbeef> This is talking about a `var a = b` right? |
06:01:00 | FromDiscord | <Elegantbeef> > If an object contains a seq it might accidently trash your perf |
06:01:13 | FromDiscord | <treeform> Like do you think switching https://github.com/treeform/pixie/blob/master/src/pixie/paths.nim#L31 |
06:01:20 | FromDiscord | <treeform> path from ref to object will be faster? |
06:02:20 | FromDiscord | <treeform> We use plain object Path in the past and it was slower because copies |
06:02:43 | FromDiscord | <Elegantbeef> Do you have benchmarks i can test with? |
06:02:58 | FromDiscord | <treeform> yeah this one |
06:02:59 | FromDiscord | <treeform> https://github.com/treeform/pixie/blob/master/tests/benchmark_svg.nim |
06:03:03 | FromDiscord | <treeform> main bench for path filling |
06:03:14 | FromDiscord | <Elegantbeef> Ah ok thanks |
06:13:58 | FromDiscord | <huantian> If you wanna make fast arc code make everything sink and lent |
06:14:02 | FromDiscord | <huantian> That’ll be sure to help |
06:22:10 | FromDiscord | <Elegantbeef> Presently there is no difference between the three states |
06:22:23 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/962236014687055882/image.png |
06:31:51 | * | Gustavo6046 quit (Quit: Goodbye! Leave messages at my XMPP @ [email protected] or my Discord Gustavo6046#9009 or possibly my Mastodon [email protected] – I don't check my email often since it's full of crap, but in any case, [email protected]) |
06:34:36 | FromDiscord | <treeform> It looks like you did make justObj go a little faster? |
06:34:45 | FromDiscord | <Elegantbeef> Nah |
06:35:00 | FromDiscord | <Elegantbeef> They're all within a margin of error |
06:35:13 | FromDiscord | <treeform> true |
06:35:34 | FromDiscord | <treeform> is this with arc? |
06:35:41 | FromDiscord | <treeform> intel cpu? |
06:35:46 | FromDiscord | <Elegantbeef> Nah with refc on an intel cpu |
06:35:52 | FromDiscord | <treeform> linux? |
06:36:01 | FromDiscord | <treeform> what does arc do? |
06:36:06 | FromDiscord | <Elegantbeef> Orc is around 2ms faster |
06:36:14 | FromDiscord | <treeform> show |
06:36:21 | FromDiscord | <Elegantbeef> Need to try all three again |
06:38:03 | FromDiscord | <Elegantbeef> 2ms faster but they're all within the same error |
06:38:15 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/962240004548067418/image.png |
06:38:28 | FromDiscord | <Elegantbeef> That's with orc and assuming there isnt cyclic it's the same |
06:38:37 | FromDiscord | <Elegantbeef> same as arc\ |
06:39:34 | FromDiscord | <treeform> its all even closer together now |
06:39:39 | FromDiscord | <Elegantbeef> Where you'll see benefits is if you're moving `Path` around of course |
06:40:45 | FromDiscord | <treeform> I think the SVG stuff moves paths around quite a lot |
06:40:57 | FromDiscord | <Elegantbeef> Into collections? |
06:41:14 | FromDiscord | <treeform> probably not |
06:41:35 | FromDiscord | <Elegantbeef> Yea that's what i mean though, it's a simple pointer assignment when you do `seq[Path].add` |
06:42:01 | FromDiscord | <TryAngle> Is there a good resource to understand the new arc / orc runtime? |
06:42:26 | FromDiscord | <Elegantbeef> There is the memory management docs, but it's just move semantics really |
06:42:37 | FromDiscord | <Elegantbeef> Nim unlike rust copies when it cannot move memory |
06:42:56 | FromDiscord | <TryAngle> Ah so it becomes "like rust" in that sense? |
06:42:59 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/destructors.html |
06:43:18 | FromDiscord | <Elegantbeef> Yes ARC is basically 1\:1 to rust's memory model minus a borrow checker |
06:43:27 | FromDiscord | <Elegantbeef> Orc is that memory model with a cycle breaker on top |
06:43:36 | FromDiscord | <TryAngle> Ah both sound awesome |
06:44:08 | FromDiscord | <Elegantbeef> https://nim-lang.org/blog/2020/10/15/introduction-to-arc-orc-in-nim.html a nice writeup aswell |
06:44:57 | FromDiscord | <guzba> @treeform @ElegantBeef path is not a ref object vs non-ref for performance reasons. it was a plain object for a long time. it became a ref object for bindings generated by genny. complex basic value types + seqs or other gc memory does not work well together |
06:45:15 | FromDiscord | <guzba> when exported in a dll |
06:46:00 | FromDiscord | <guzba> instead we just give a the ptr to other languages and touch the dll / nim memory through dll api procs that are bound to in the other languages (eg python) |
06:46:19 | FromDiscord | <Elegantbeef> Generally speaking though the memory management is much smarter and you can encourage resources to be moved if needed |
06:46:20 | FromDiscord | <Elegantbeef> Like i showed prior, instead of copying on assignment sometimes memory is just moved if it can be |
06:46:21 | FromDiscord | <guzba> exporting a value type path from nim to python is crazy. value semantics + invisible refs + by copy etc |
06:46:24 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UFA |
06:47:37 | FromDiscord | <Elegantbeef> To be fair in that case it was treeform's example 😛 |
06:48:17 | FromDiscord | <Elegantbeef> When talking about the `Bitseq` i'd argue having the same semantics as all the other collections with a `BitSeqRef` seems sensible |
06:49:08 | FromDiscord | <Elegantbeef> Shit my arc showcase of move semantics isnt smart enough to show the actual movement |
06:49:26 | FromDiscord | <guzba> bitty is sort of a strange case. really using set[bool] is better whenever possible↵bitty only wins in unique access patterns and even then i could prob make set[bool] as fast |
06:50:09 | FromDiscord | <guzba> as for it being a ref type, for my i default to making things value type until it needs a seq on it |
06:50:12 | FromDiscord | <Elegantbeef> Eh you also might be able to just use `set[0..high]` depending on the use case |
06:50:24 | FromDiscord | <guzba> seq + object always copies and is absolutely horrible for performance in every case ive seen |
06:50:26 | FromDiscord | <guzba> maybe its better now |
06:50:37 | FromDiscord | <guzba> it also depends on how much proc param usage is likely |
06:50:49 | FromDiscord | <Elegantbeef> It always copies on copy yes, that's the semantics nim has 😛 |
06:50:53 | FromDiscord | <guzba> strings also are very bad on object |
06:51:04 | FromDiscord | <guzba> yep its all good |
06:51:14 | FromDiscord | <guzba> its just i am not going to make something internal slower for no good reason |
06:51:28 | FromDiscord | <guzba> eg path filling, gzip encode/decode, png loading, etc |
06:51:40 | FromDiscord | <guzba> i never ever ever want an image blob of pixels to be copied |
06:51:54 | FromDiscord | <guzba> tree and i dispute ref vs value type all the time |
06:52:07 | FromDiscord | <guzba> such is programming |
06:53:00 | FromDiscord | <Elegantbeef> View types when |
06:53:10 | FromDiscord | <Elegantbeef> Personally i just prefer the cases where `ref T` needed use a `ref T` |
06:53:28 | FromDiscord | <Elegantbeef> And have my underlying `object` exist happily for places where i dont want extra indirection |
06:53:35 | FromDiscord | <Elegantbeef> But then again i dont write anything but toys 😛 |
06:56:25 | FromDiscord | <guzba> that's a fine choice, wouldn't really want to hard position myself against that. i think for simplicity we simply have decided what best represents the concept and its usage pattern and just make it that. mostly a simple-for-our-use-case-probably-fine-for-everyone-else thing |
06:56:48 | FromDiscord | <guzba> not always really clear and we may do it different now if we could like "forget" a lib and re-do it |
06:56:58 | FromDiscord | <guzba> (edit) "not always really clear ... and" added "which way to go" |
07:00:23 | FromDiscord | <Elegantbeef> Hey be more like me and have no one use your code, it gets super easy to refactor! |
07:01:52 | FromDiscord | <guzba> i dunno if you can lay that claim anymore mr beef, i see stars on your repos |
07:02:18 | FromDiscord | <Elegantbeef> No issues though |
07:02:53 | FromDiscord | <guzba> perhaps they are simply perfect libs |
07:03:28 | FromDiscord | <Elegantbeef> Speaking of @auxym dont know if i bugged you properly in the issue but autolinking for picostdlib is done, give it a whirl when you get a chance |
07:39:12 | * | jmdaemon quit (Ping timeout: 260 seconds) |
07:42:32 | FromDiscord | <aph> ive successfully made nim dynamic with some random inheritance, i feel evil |
07:44:03 | FromDiscord | <Rika> Not really dynamic that way I don’t think |
07:44:13 | FromDiscord | <Phil> We can't do de-structuring of arrays right? Thinking of something like↵`let action, role = "add_guest".split("\_")` |
07:44:15 | FromDiscord | <Phil> (edit) ""add_guest".split("\_")`" => ""add_guest".split("_")`" |
07:44:36 | FromDiscord | <Elegantbeef> You can with macros, bunch of libraries that enable it |
07:44:36 | * | adigitoleo joined #nim |
07:45:23 | adigitoleo | Does the first example work for anyone else: https://nim-lang.org/docs/tut3.html#introduction-generating-code |
07:47:14 | FromDiscord | <Solitude> yes, it does |
07:47:55 | FromDiscord | <aph> i got `/usercode/in.nim(1, 24) Error: expression expected, but found 'keyword let'` when running it on the playground |
07:48:03 | FromDiscord | <aph> In reply to @Rika "Not really dynamic that": true heh |
07:48:03 | FromDiscord | <Solitude> oh, you mean first small snippet |
07:48:08 | adigitoleo | Yeah same, https://play.nim-lang.org/#ix=3UFH |
07:48:47 | adigitoleo | third exampe also doesn't want to compile |
07:49:39 | FromDiscord | <Solitude> someone wanted to play ascii golf and save on newlines |
07:50:13 | adigitoleo | Hah, well that solves it |
07:50:23 | adigitoleo | cheers |
08:25:22 | * | jjido joined #nim |
09:19:40 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
09:33:20 | FromDiscord | <aph> is there a type of a bit? i don't wanna use `int` then `.toBin` heh |
09:36:23 | FromDiscord | <aph> oh nvm doesn't seem to be one |
09:36:59 | * | lumo_e joined #nim |
09:38:26 | FromDiscord | <Rika> how would that work |
09:40:30 | FromDiscord | <aph> In reply to @Rika "how would that work": i'm finding a thing like bit array or smth, that stores 8 bits of true/false |
09:40:50 | FromDiscord | <aph> (edit) "In reply to @Rika "how would that work": i'm finding a thing like bit array or smth, that stores 8 bits of true/false ... " added "(1/0)" |
09:41:21 | FromDiscord | <aph> checking if there's things builtin heh but i'm sure `toBin` will work |
09:42:36 | FromDiscord | <aph> oh such thing will actually use more bytes. |
09:42:48 | FromDiscord | <aph> since bools are 8bits not 1 |
09:43:04 | FromDiscord | <Yardanico> one way is to use bitsize and have an object with 8 bool fields with bitsize 1 i think |
09:43:24 | FromDiscord | <aph> In reply to @Yardanico "one way is to": ooh |
09:44:01 | FromDiscord | <Yardanico> but i'm sure there's an easier way, i just remember |
09:44:32 | FromDiscord | <Yardanico> sent a code paste, see https://paste.rs/oUT |
09:44:37 | FromDiscord | <Yardanico> (edit) "but i'm sure there's an easier way, i just ... remember" added "don't" |
09:45:13 | FromDiscord | <aph> `bitsize` is cool |
09:45:54 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-bitsize-pragma |
09:47:19 | FromDiscord | <Yardanico> also you can use sets |
09:48:15 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3UGk |
09:48:39 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#types-set-type |
09:49:38 | FromDiscord | <aph> wait what wow |
09:49:52 | FromDiscord | <aph> that actually store less, cool |
09:54:18 | FromDiscord | <konsumlamm> In reply to @Elegantbeef "Yes ARC is basically": except that reference counting isn't the default in Rust |
10:03:58 | * | jjido joined #nim |
10:16:07 | FromDiscord | <Valdar> In reply to @aph "wait what wow": I use https://nim-lang.org/docs/bitops.html for bool type manipulation. Works great and fast as well |
10:16:52 | FromDiscord | <aph> woah thanks! |
10:19:03 | FromDiscord | <Valdar> np. you can do a lot with just toBin, fromBin, and testBit |
10:19:45 | FromDiscord | <Valdar> (edit) "np. you can do a lot with just toBin, fromBin, ... and" added "setBit, clearBit," |
10:26:06 | FromDiscord | <Phil> Man, organizing an application is hard |
10:36:52 | FromDiscord | <Yardanico> In reply to @Valdar "I use https://nim-lang.org/docs/bitops.html for": yeah but specifically for bools sets are nicer to use |
10:42:28 | FromDiscord | <Valdar> Maybe it's what you get accustomed to, or maybe the use case. Sets look confusing to me, but maybe I'd need to invest more time in them. |
10:43:44 | FromDiscord | <Rika> theyre not a common feature in languages |
10:44:04 | NimEventer | New thread by Dxb: Result of applying high()/low() to a range typedesc, see https://forum.nim-lang.org/t/9094 |
11:02:07 | FromDiscord | <Valdar> Well, more accurately, I find the documentation for sets confusing. I really should give them a try at some point though. |
11:04:21 | * | zeus-supreme1 joined #nim |
11:05:41 | FromDiscord | <Yardanico> In reply to @Valdar "Well, more accurately, I": well you can also use the bitsize pragma for bools as I showed previously |
11:06:01 | FromDiscord | <Yardanico> i think it's a bit unclean to use bitops for storing multiple bools in one byte |
11:06:10 | FromDiscord | <exelotl> Sets are great! |
11:06:11 | FromDiscord | <Yardanico> since you don't even have the bools with different variables |
11:07:25 | FromDiscord | <exelotl> bitsize pragma has the problem that the nim compiler doesn't know the size of the object anymore |
11:07:30 | * | zeus-supreme quit (Read error: Connection reset by peer) |
11:08:38 | FromDiscord | <Yardanico> well, we were talking about 8 bools in 1 byte, the simplest case |
11:08:54 | FromDiscord | <Yardanico> sent a code paste, see https://paste.rs/s8h |
11:09:25 | FromDiscord | <Yardanico> but using sets for this is better anyway :) |
11:09:33 | FromDiscord | <Valdar> yeah, I can see where that would be very useful |
11:10:46 | FromDiscord | <exelotl> sent a code paste, see https://paste.rs/Mdm |
11:10:57 | FromDiscord | <Yardanico> well it didn't fail, it just showed 1 |
11:11:04 | FromDiscord | <Yardanico> ah, compiletime |
11:11:12 | FromDiscord | <Yardanico> yeah you're right |
11:11:13 | FromDiscord | <Valdar> I'm doing a lot or ORing and ANDing with my use case, so bitops are a good fit for me |
11:14:01 | * | kayabaNerve quit (Ping timeout: 248 seconds) |
11:17:39 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
11:18:00 | FromDiscord | <ShalokShalom> sent a long message, see http://ix.io/3UGC |
11:18:27 | FromDiscord | <ShalokShalom> (edit) "http://ix.io/3UGC" => "http://ix.io/3UGD" |
11:18:35 | FromDiscord | <ShalokShalom> sent a long message, see http://ix.io/3UGD |
11:21:38 | FromDiscord | <Rika> shalok wrt. emacs, emacs or vi? |
11:21:46 | FromDiscord | <ShalokShalom> wrt? |
11:21:52 | FromDiscord | <Rika> with regards to |
11:21:58 | FromDiscord | <ShalokShalom> how you mean? |
11:22:06 | FromDiscord | <Rika> which do you prefer |
11:22:16 | FromDiscord | <ShalokShalom> doom |
11:22:24 | FromDiscord | <ShalokShalom> if it needs to be something out of this bunch |
11:22:26 | FromDiscord | <Rika> okay, thats all really |
11:22:38 | FromDiscord | <ShalokShalom> how you mean? |
11:22:44 | FromDiscord | <Rika> no i was just curious |
11:22:49 | FromDiscord | <ShalokShalom> ah, ok |
11:32:09 | * | lumidify quit (Ping timeout: 248 seconds) |
11:37:39 | FromDiscord | <Zoom> You know what, funnily, if you do a ton of dumb seq manipulations, including mass-concatenation of newly created single-element seqs, refc performs up to several times faster than arc/orc. As seen here\: https://forum.nim-lang.org/t/9079↵(<@709044657232936960_yoyojambo=5b=49=52=43=5d>) |
11:41:59 | FromDiscord | <Zoom> Except the sink/lent is completely backwards for now. You can lent-mark a return, but you can't lend an argument to a proc! It's comically frustrating. View types look like an unfinished job to me. |
11:43:23 | FromDiscord | <Rika> In reply to @Zoom "You know what, funnily,": because "faster" is not a good way to describe GCs |
11:43:29 | FromDiscord | <Rika> there's many kinds of "faster" |
11:43:38 | FromDiscord | <Rika> more throughput, less latency, ... |
11:43:50 | FromDiscord | <Rika> ARC is better in the latter, refc in the former |
11:45:52 | FromDiscord | <Zoom> For the code I described it's completely unambiguous. Faster = less allocs, which also means more throughput and less latency. |
11:46:15 | FromDiscord | <Yardanico> yeah ARC is more "correct" in that it cleans up right after the operation |
11:46:25 | FromDiscord | <Zoom> I use orc as a default, btw. |
11:47:26 | * | lumidify joined #nim |
11:49:28 | FromDiscord | <Yardanico> nice |
11:55:37 | FromDiscord | <Zoom> "BTW, I use ARC" lol |
12:02:06 | FromDiscord | <Phil> The arc beacons have been lit!↵No not the arch beacons!↵The ARC beacons! |
12:11:44 | FromDiscord | <ShalokShalom> @RikaYou are a beginner to Nim or programming? |
12:12:14 | FromDiscord | <ShalokShalom> Since we were talking the last time, and you meant you are also a beginner.↵I meant to programming as a whole, which might have sparked some confusion. |
12:12:21 | FromDiscord | <ShalokShalom> I guess you mean to Nim. |
12:13:10 | FromDiscord | <Rika> i was |
12:13:13 | FromDiscord | <Rika> not anymore |
12:13:23 | FromDiscord | <Rika> my point was that |
12:13:31 | FromDiscord | <Rika> when i was a beginner, i didnt think it was confusing |
12:13:46 | FromDiscord | <Rika> of course that anecdote has a sample of 1 |
12:19:58 | FromDiscord | <ShalokShalom> Yeah, but to programming or Nim? |
12:20:08 | FromDiscord | <ShalokShalom> Since I think obviously, that makes a difference. |
12:21:53 | FromDiscord | <Rika> ah |
12:22:12 | FromDiscord | <Rika> uh to nim technically since by then i had maybe 2 years effective programming experience with python |
12:22:23 | FromDiscord | <Rika> but i still learned a lot by moving to nim |
12:23:00 | FromDiscord | <Rika> speaking of, i'm thinking maybe i should try porting an async framework, python's trio got me interested |
12:27:21 | FromDiscord | <ShalokShalom> Do you know the Erlang model? |
12:30:19 | FromDiscord | <Rika> no |
12:30:37 | FromDiscord | <Rika> it might be difficult to port that |
12:44:48 | FromDiscord | <Tanguy> sent a code paste, see https://paste.rs/Iqm |
12:44:57 | FromDiscord | <Tanguy> Or something equivalent |
12:52:57 | FromDiscord | <Zoom> Why do people insist on breaking stuff? May be return pointer from hey? |
12:54:01 | FromDiscord | <Rika> In reply to @Tanguy "Is it possible to": Maybe use an actual global? |
12:56:41 | FromDiscord | <Tanguy> Ofc my real use case is more complex than that, I can't return a pointer nor use a real global |
12:57:47 | FromDiscord | <Zoom> Then I can only suggest you stop trying to milk a stone.↵(@Tanguy) |
12:58:40 | FromDiscord | <xflywind> sent a code paste, see https://paste.rs/WR4 |
12:59:45 | FromDiscord | <Tanguy> Mhh, smart |
12:59:53 | FromDiscord | <Tanguy> Thanks! |
13:01:02 | FromDiscord | <xflywind> you are welcome |
13:32:54 | * | jjido joined #nim |
13:36:38 | * | jjido quit (Client Quit) |
13:44:19 | * | SamuelMarks joined #nim |
13:54:02 | * | arkurious joined #nim |
13:58:29 | FromDiscord | <demotomohiro> I wonder why you cannot declare zMyvariable as global and you need to declare global inside proc? |
14:03:33 | * | SamuelMarks quit (Ping timeout: 256 seconds) |
14:07:40 | * | SamuelMarks joined #nim |
14:10:12 | FromDiscord | <Valdar> In reply to @demotomohiro "I wonder why you": Is this not global?↵https://play.nim-lang.org/#ix=3RVf |
14:11:27 | * | rockcavera joined #nim |
14:11:27 | * | rockcavera quit (Changing host) |
14:11:27 | * | rockcavera joined #nim |
14:13:38 | FromDiscord | <leorize> try sharing it again, that link got me a python script |
14:17:07 | FromDiscord | <Valdar> um, yeah, it does. That's weird. Is playground broken again? |
14:19:27 | FromDiscord | <aph> maybe ix.io broke |
14:20:08 | FromDiscord | <Valdar> it runs, but when it share it changes everything to python lol |
14:20:33 | FromDiscord | <Valdar> try this. I manually put in the env↵https://play.nim-lang.org/#ix=3UHc |
14:21:13 | FromDiscord | <aph> this one isn't python this time |
14:21:15 | FromDiscord | <aph> weird |
14:21:18 | FromDiscord | <aph> ¯\\_(ツ)\_/¯ |
14:23:02 | FromDiscord | <demotomohiro> variables outside of a proc become global variable in C. |
14:23:50 | FromDiscord | <Valdar> correct |
14:24:19 | FromDiscord | <Valdar> did I misread what you meant? |
14:27:54 | FromDiscord | <demotomohiro> @Tanguy Said cannot use a real global variable and @xflywind 's {.global, exportc.}/{importc,nodecl.} code works. That sound like strange. |
14:29:52 | FromDiscord | <Valdar> Yeah, not sure in what context he couldn't create/use a global |
14:31:36 | FromDiscord | <Tanguy> sent a code paste, see https://paste.rs/Uau |
14:32:12 | FromDiscord | <!Patitotective> sent a code paste, see https://paste.rs/qkh |
14:32:16 | FromDiscord | <Rika> In reply to @Tanguy "Basically, I have a": Sounds very fragile. |
14:32:49 | FromDiscord | <Rika> In reply to @Patitotective "is there a shorter": What are you trying to avoid? You’re still allocating a new string with the lower half |
14:32:51 | FromDiscord | <demotomohiro> In @xflywind 's code, zMyvariable is declared as let but zMyvariable is declared as var outside of the proc. That looks wrong. |
14:35:37 | FromDiscord | <!Patitotective> In reply to @Rika "What are you trying": id like define all the variables in a single statement↵also, if i could set the `"00"` to all variable too |
14:35:37 | FromDiscord | <Valdar> In reply to @Tanguy "Basically, I have a": can't you just instantiate the variable before you enter the block? |
14:35:42 | FromDiscord | <!Patitotective> (edit) "variable" => "variables" |
14:36:35 | FromDiscord | <Tanguy> Because it's a recursive macro, no |
14:37:05 | FromDiscord | <Valdar> In reply to @Tanguy "Because it's a recursive": 👍 |
14:37:29 | FromDiscord | <leorize> you could use your global stash and put it in front of your procs instead↵(@Tanguy) |
14:38:13 | FromDiscord | <leorize> the thing with importc and exportc is that identifier mangling is disabled, and not to mention that you can't assume `{.global.}` will always be implemented that way |
14:38:58 | FromDiscord | <demotomohiro> @Tanguy xflywind's technique would not work if multiple variables in different procs have same name. |
14:39:15 | * | SamuelMarks quit (Ping timeout: 256 seconds) |
14:39:41 | FromDiscord | <Tanguy> Don't worry about me, I know it's a hacky workaround, but it's all I need at the moment, and more importantly, the only easy way to plonk this into my existing macro 🙂 |
14:40:16 | FromDiscord | <leorize> you can just `= "00"` all of them at declaration lol↵(@!Patitotective) |
14:40:47 | FromDiscord | <!Patitotective> In reply to @leorize "you can just `=": but i need to do the `newString` stuff |
14:40:55 | FromDiscord | <!Patitotective> (edit) "In reply to @leorize "you can just `=": but i need to do the `newString` stuff ... " added "(like, define their size)" |
14:41:02 | FromDiscord | <leorize> why? |
14:41:31 | FromDiscord | <!Patitotective> cause those are the buf of my `igInputText` (dear imgui) |
14:41:36 | FromDiscord | <Yardanico> In reply to @Patitotective "is there a shorter": you don't need slices here btw |
14:41:46 | FromDiscord | <Yardanico> if it's already 2 chars and you're assigning two chars |
14:41:50 | FromDiscord | <Rika> In reply to @Patitotective "cause those are the": What does that have to do with? |
14:41:52 | FromDiscord | <Yardanico> or do you want to prevent a copy or something |
14:42:05 | FromDiscord | <Yardanico> In reply to @Patitotective "cause those are the": nim automatically resizes the buffer of strings for you |
14:42:17 | FromDiscord | <!Patitotective> let me try it |
14:42:18 | FromDiscord | <Yardanico> when you need to pass a string to a C function you just do `myCall(mystring[0].addr, mystring.len)` |
14:42:29 | FromDiscord | <Yardanico> that's if it's a simple ASCII string of course |
14:42:56 | FromDiscord | <leorize> if that's the case then there's a reason to do it like that |
14:43:53 | FromDiscord | <!Patitotective> it worked, thanks 🙃 |
14:44:36 | FromDiscord | <leorize> Nim will keep strings in static memory until modifications are done on it. If you were to directly pass that to C code that modifies it, it might SIGSEGV |
14:45:37 | FromDiscord | <leorize> if the procs you're calling won't modify the string, then you can safely use the initial buffer from the constant assignment |
15:06:03 | * | lumidify quit (Ping timeout: 268 seconds) |
15:09:54 | FromDiscord | <xflywind> In reply to @demotomohiro "In <@658563905425244160> 's code,": `let zMyvariable {.importc, nodecl.}: int` this works too. |
15:16:10 | FromDiscord | <ITR> Is there any way I can declare a proc has no side effects, even if it technically does? |
15:17:06 | FromDiscord | <leorize> put all the code in the proc body in this block\: `{.cast(noSideEffect).}:` |
15:22:57 | FromDiscord | <xflywind> Is it possible to implement karax like dsl using typed ast? |
15:26:17 | * | slowButPresent joined #nim |
15:28:23 | FromDiscord | <ITR> In reply to @leorize "put all the code": ty |
15:40:35 | FromDiscord | <leorize> yes, but it will be painful↵(@xflywind) |
15:45:10 | * | PMunch joined #nim |
15:49:25 | FromDiscord | <xflywind> In reply to @leorize "yes, but it will": With untyped, I cannot use getImpl on procs in dsl. My current workaround it to store the impl node of procs at compile time by proc name. I duuno how far I can go with untyped ast. |
15:50:11 | * | Gustavo6046 joined #nim |
15:52:10 | * | Gustavo6046 quit (Max SendQ exceeded) |
15:53:20 | * | Gustavo6046 joined #nim |
16:01:22 | FromDiscord | <!Patitotective> sent a code paste, see https://paste.rs/vYo |
16:02:49 | FromDiscord | <Yardanico> no, but you can just format yourself |
16:02:58 | FromDiscord | <Yardanico> https://nim-lang.org/docs/strutils.html#intToStr%2Cint%2CPositive minchars |
16:03:08 | FromDiscord | <Yardanico> `echo intToStr(1, 2)` |
16:03:22 | FromDiscord | <!Patitotective> 👍 |
16:22:13 | * | vicfred joined #nim |
16:23:00 | FromDiscord | <Ayy Lmao> sent a code paste, see https://paste.rs/Rpe |
16:24:04 | FromDiscord | <Ayy Lmao> I can't seem to find a way to have conditional compilation within the same type block |
16:25:44 | FromDiscord | <Ayy Lmao> Actually I probably don't even need these functions to live in the platform data. |
16:26:53 | PMunch | Hmm, not sure if you can do that |
16:27:11 | * | vicfred quit (Quit: Leaving) |
16:27:40 | FromDiscord | <Yardanico> In reply to @Ayy Lmao "Is it possible to": maybe what you want is this? |
16:27:53 | * | SamuelMarks joined #nim |
16:27:56 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3UHB |
16:28:33 | FromDiscord | <Yardanico> ah nvm, I see what you mean, recursive types |
16:29:16 | FromDiscord | <Yardanico> if it's possible in your code, you can just place ClientPlatformData below Client |
16:29:26 | FromDiscord | <Ayy Lmao> I am actually able to get away with having the recursive type functions live in the `Client` object itself so I can avoid this issue |
16:29:27 | FromDiscord | <Yardanico> ah nvm, that won't work again |
16:29:46 | FromDiscord | <Ayy Lmao> But still curious if there is some way to get something like that to work |
16:30:19 | FromDiscord | <Ayy Lmao> Can you not forward declare a type? |
16:31:01 | FromDiscord | <Ayy Lmao> I tried but then the compiler complains about duplicate definitions |
16:31:28 | FromDiscord | <Phil> Out of curiosity, how do you actually style your stuff on desktop applications? Is there something CSS like? |
16:31:34 | FromDiscord | <Yardanico> In reply to @Ayy Lmao "Can you not forward": there's a thing but it's not really tested |
16:31:36 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual_experimental.html#package-level-objects |
16:31:44 | FromDiscord | <Yardanico> i mean that i haven't seen anyone use it |
16:31:49 | FromDiscord | <Phil> (edit) "like?" => "like?↵Not that I've ever done it or have active plans, the question just occurred to me" |
16:32:24 | * | SamuelMarks quit (Ping timeout: 246 seconds) |
16:32:31 | FromDiscord | <Yardanico> but they can only be passed as `ref` objects as said in the description |
16:32:46 | FromDiscord | <Phil> (edit) "me" => "me↵As a webdev I'm mostly familiar with the way of using HTML to define elements on a surface, styling it with CSS and giving it behaviour with JS:" |
16:32:50 | FromDiscord | <Phil> (edit) "JS:" => "JS." |
16:33:08 | FromDiscord | <Yardanico> In reply to @Isofruit "Out of curiosity, how": it depends, modern GUI frameworks have their own ways of styling |
16:33:28 | FromDiscord | <Yardanico> Qt basically uses CSS with some changes |
16:34:06 | FromDiscord | <Phil> I assume Qt defines elements as objects in whatever language is using QT and provides it with behaviour using that same language? |
16:36:52 | * | xet7 quit (Remote host closed the connection) |
16:37:58 | * | xet7 joined #nim |
16:40:33 | FromDiscord | <spoon> is there any documentation on nimeval/llstream/any of the compiler modules? |
16:43:05 | * | Gustavo6046 quit (Ping timeout: 248 seconds) |
16:55:49 | * | lumo_e quit (Ping timeout: 268 seconds) |
16:59:32 | FromDiscord | <auxym> In reply to @Elegantbeef "Speaking of <@882793909246369864> dont": Will do! |
17:04:55 | * | vicfred joined #nim |
17:10:39 | * | jmdaemon joined #nim |
17:34:40 | * | zeus-supreme joined #nim |
17:37:30 | * | zeus-supreme1 quit (Ping timeout: 246 seconds) |
17:39:53 | * | PMunch quit (Quit: leaving) |
17:41:13 | * | SamuelMarks joined #nim |
17:51:41 | * | lumo_e joined #nim |
17:54:26 | * | neurocyte8614492 joined #nim |
17:56:53 | * | vicfred quit (Quit: Leaving) |
17:57:36 | NimEventer | New thread by Araq: Lexim -- Regular expressions and lexer generation for Nim, see https://forum.nim-lang.org/t/9095 |
18:08:51 | * | xet7 quit (Remote host closed the connection) |
18:11:28 | * | xet7 joined #nim |
18:21:09 | FromDiscord | <!Patitotective> is there a way i could send notifications from code? or do i need to depending on the system use a command? |
18:25:07 | FromDiscord | <d4rckh> @Phil hi, this was long time ago but i figured out how to split the file between threads 🙂 |
18:25:10 | FromDiscord | <d4rckh> (edit) "🙂" => "😄" |
18:25:40 | FromDiscord | <d4rckh> before everything else im running a function which reads the file and splits it in multiple ones in the temp file |
18:25:58 | FromDiscord | <d4rckh> then those threads get the file name and can start a file stream against it |
18:32:02 | FromDiscord | <Phil> In reply to @d4rckh "<@180601887916163073> hi, this was": Wait, so you split the file into n tempfiles and read in one per thread? |
18:32:05 | FromDiscord | <Phil> And that's.... faster? |
18:32:18 | FromDiscord | <d4rckh> yes...? |
18:32:47 | FromDiscord | <Yardanico> but can't you just read the file and pass the chunks to the threads directly |
18:33:04 | FromDiscord | <d4rckh> i tried |
18:33:15 | FromDiscord | <d4rckh> i kept getting memory leaks |
18:33:20 | FromDiscord | <Phil> I may not have enough knowledge of low level file stuff to comprehend how splitting a file in terms of computation isn't somewhere in the neighbourhood of reading the same file |
18:34:22 | FromDiscord | <Phil> The usecase was really massive files IIRC, right? |
18:35:14 | FromDiscord | <Ayy Lmao> Is it advised to use `create` and `dealloc` on a ref type if I have specific places from c interop where it's supposed to be created and destroyed? |
18:35:17 | FromDiscord | <d4rckh> yes, 3 to 100mb |
18:35:39 | FromDiscord | <Zoom> Do you read-only or write too? How massive we're talking?↵(@d4rckh) |
18:35:57 | FromDiscord | <Yardanico> In reply to @Ayy Lmao "Is it advised to": you can just used the usual creation together with GC_ref and GC_unref |
18:36:00 | FromDiscord | <d4rckh> In reply to @Zoom "Do you read-only or": im only reading from it, i just needed to split the file in chunk between multiple threads, its just a web fuzzer |
18:36:08 | FromDiscord | <d4rckh> (edit) "chunk" => "chunks" |
18:36:21 | FromDiscord | <d4rckh> https://github.com/d4rckh/vaf/blob/vaf-threads/src/utils/VafWordlist.nim#L12↵this is how im doing it now |
18:36:58 | FromDiscord | <Phil> I'm curious, how does that work? Can you just tell it to blindly jump 1 MB worth of data ahead and designate that as a new chunk to read in? |
18:37:17 | FromDiscord | <Ayy Lmao> In reply to @Yardanico "you can just used": Interesting, I had no idea those existed. I'm still newish at lower level interop. Thanks! |
18:38:24 | FromDiscord | <d4rckh> In reply to @Isofruit "I'm curious, how does": you supply the n thread count via an argument and the proc splits the list in n files and then the each file name is passed to each thread which can start its own file stream |
18:38:34 | FromDiscord | <d4rckh> (edit) removed "the" |
18:41:53 | FromDiscord | <Phil> sent a long message, see http://ix.io/3UI8 |
18:42:12 | FromDiscord | <d4rckh> In reply to @d4rckh "https://github.com/d4rckh/vaf/blob/vaf-threads/src/": no, you can see the code here |
18:42:15 | FromDiscord | <Phil> (edit) "http://ix.io/3UI8" => "http://ix.io/3UI9" |
18:42:24 | FromDiscord | <Phil> (edit) "http://ix.io/3UI9" => "http://ix.io/3UIa" |
18:43:07 | FromDiscord | <d4rckh> its basically counting the lines and when it gets to the number of threads it setting the iterator to `0` |
18:43:13 | FromDiscord | <d4rckh> so it goes 0,1,2,0,1,2 |
18:43:17 | FromDiscord | <Phil> Wordlistfile is your single file you want to read in? |
18:43:21 | FromDiscord | <d4rckh> yes |
18:45:18 | FromDiscord | <d4rckh> i just gave it a 139mb text file and it handled it just fine |
18:45:26 | FromDiscord | <d4rckh> it just took a bit to split it |
18:49:35 | * | jjido joined #nim |
18:51:41 | FromDiscord | <Yardanico> hm, I still think that there are better ways |
18:51:49 | FromDiscord | <Yardanico> also your code looks like it's doing a lot of allocations, e.g. `var word = prefix & line & suffix` |
18:52:23 | FromDiscord | <Phil> So you have a set of prefixes and a set of suffixes that count for all lines.↵You take a file, you read it in completely line-by-line through `strm` with a single thread and write every combination of prefix + line + suffix into their own temp-file. A set of prefix-line-suffix combinations always gets written into the same file.↵You then return the seq of temp filenames and read those in individually in some other module, I grasped that |
18:53:06 | FromDiscord | <d4rckh> yup |
18:53:43 | FromDiscord | <d4rckh> each thread has its own temp file with its own set of prefix-line-suffix combination |
18:53:44 | FromDiscord | <Phil> Oh yeah, for string concat a nice way is adding to an existing string |
18:54:03 | FromDiscord | <Phil> IIRC at least |
18:55:00 | FromDiscord | <d4rckh> In reply to @Yardanico "also your code looks": isnt & doing only concatnig? |
18:55:02 | FromDiscord | <d4rckh> (edit) "concatnig?" => "concating?" |
18:55:29 | FromDiscord | <Yardanico> yes, but it's also creating temp strings each time |
18:55:33 | FromDiscord | <Phil> I had this debate a while ago, IIRC & doesn't do it inline |
18:55:35 | FromDiscord | <Phil> (edit) "I had this debate a while ago, IIRC & doesn't do it inline ... " added "or sth" |
18:55:42 | FromDiscord | <d4rckh> oh, then im doing string formats |
18:55:42 | FromDiscord | <Phil> so `add` is preferrable |
18:55:53 | FromDiscord | <d4rckh> (edit) "doing" => "gonna do" | "formats" => "format" |
18:55:57 | FromDiscord | <jmgomez> hey guys, can you export a nim type to cpp as class instead of struct? |
18:56:15 | FromDiscord | <Yardanico> In reply to @d4rckh "oh, then im gonna": you can just do `var word = newStringOfCap(prefix.len + line.len + suffix.len)` and then `word.add` all 3. I think it should be better |
18:56:30 | FromDiscord | <Yardanico> i mean you don't neccessarily need newStringOfCap, it's just another optimization so there's only 1 new allocation |
18:57:24 | FromDiscord | <d4rckh> oh i see i see, thanks |
18:57:58 | FromDiscord | <Phil> I feel like I'm missing something though, what's stopping you from making a massive seq[String] for each line (since you're already reading those in) and passing references to that data structure around? |
18:58:17 | FromDiscord | <Phil> (edit) "each line" => "all the lines" |
18:58:34 | FromDiscord | <d4rckh> well that means im reading the entire file in right? |
18:59:05 | FromDiscord | <Phil> ` while strm.readLine(line):`↵This already reads in the entire file line by line, or am I missing something? |
18:59:23 | FromDiscord | <d4rckh> yes, line by line, but im not storing the entirety of the file in memory |
18:59:24 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
18:59:34 | FromDiscord | <Phil> Ahhhhh, memory constraints were what you're dealing with |
18:59:50 | FromDiscord | <Phil> See, I knew I was forgetting something |
19:00:38 | FromDiscord | <Phil> By splitting into temp files you can process them individually and keep your memory footprint below a certain level, which was the target (?) |
19:00:55 | FromDiscord | <d4rckh> yea |
19:02:09 | FromDiscord | <Phil> Hmm what were your results of the first naive approach I assume you've already done, meaning you only read in the first X lines into a seq[string] pass that forward, process it, once that's done read in the next etc. ? |
19:02:49 | FromDiscord | <d4rckh> memory leaks, but i didnt pass references <:big_think:729161514899996744> |
19:03:54 | FromDiscord | <Phil> Did you re-build a seq[string] every read-in or did you overwrite the lines in the seq[string] you built before? |
19:04:06 | FromDiscord | <Phil> (edit) "before?" => "before on your first read-in?" |
19:04:17 | FromDiscord | <Phil> (edit) "read-in" => "read-step" | "read-in?" => "read-step?" |
19:04:27 | * | SamuelMarks quit (Ping timeout: 256 seconds) |
19:06:35 | FromDiscord | <Phil> Either way, first things first, really cool it worked!↵Your solution really gets me thinking though how I myself would approach such an issue, thus all my questions ^^ |
19:08:28 | FromDiscord | <d4rckh> i was reading the wordlist, split it by \n and then i calculated the start and end indexes for each thread |
19:08:56 | FromDiscord | <d4rckh> if there were 10 words and 5 threads, first thread would get 0-5 and second 5-10 |
19:09:01 | FromDiscord | <d4rckh> (edit) "5" => "2" |
19:09:15 | ormiret | d4rckh: I had similar problem (though I was looking at binary data in fixed size packets rather than lines so the finagling of chunk boundaries would be different for you): https://play.nim-lang.org/#ix=3UIb and then `spawn` processing proc on each `MemSlice` in `parts` |
19:10:57 | ormiret | that mmaps the whole file and lets the OS deal with how much of it is actually in memory |
19:13:22 | * | jjido joined #nim |
19:23:08 | * | SamuelMarks joined #nim |
19:38:11 | * | jmd_ joined #nim |
19:38:37 | * | jmdaemon quit (Ping timeout: 268 seconds) |
19:40:35 | FromDiscord | <spoon> variables/procs when creating an nimscript interpreter should persist until it's destroyed, right? if i use `evalScript` |
19:44:08 | FromDiscord | <spoon> nvm, found the problem |
19:44:47 | * | SamuelMarks quit (Ping timeout: 268 seconds) |
19:45:58 | * | SamuelMarks joined #nim |
19:49:24 | FromDiscord | <Knightmare Legion> sent a code paste, see https://play.nim-lang.org/#ix=3UIm |
19:49:41 | FromDiscord | <Knightmare Legion> (edit) "https://play.nim-lang.org/#ix=3UIm" => "https://play.nim-lang.org/#ix=3UIn" |
19:53:19 | * | SamuelMarks quit (Ping timeout: 260 seconds) |
19:54:43 | * | SamuelMarks joined #nim |
19:55:43 | FromDiscord | <Zoom> Do you need each thread to process exact same nimber of lines?↵(@d4rckh) |
19:56:11 | FromDiscord | <d4rckh> In reply to @Zoom "Do you need each": No |
19:56:11 | FromDiscord | <Zoom> Why not just iterate lines and send them to threads in a loop while you're reading them? |
19:56:46 | FromDiscord | <d4rckh> Well if I'm reading them in a single thread... |
19:56:57 | FromDiscord | <d4rckh> (edit) "Well if I'm reading them ... inthread" added "and sending" | "thread..." => "thread" |
19:57:40 | FromDiscord | <Zoom> Does your IO benefit from parallel access? |
19:58:00 | FromDiscord | <Zoom> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/962440693618442351): Do you need each thread to process exact same number of lines? |
19:59:47 | FromDiscord | <TryAngle> https://nim-lang.org/docs/osproc.html#execCmdEx%2Cstring%2Cset%5BProcessOption%5D%2CStringTableRef%2Cstring%2Cstring↵↵do I use this to execute shell commands for example in dotfiles? |
19:59:59 | * | SamuelMarks quit (Ping timeout: 256 seconds) |
20:02:23 | FromDiscord | <!Patitotective> which library should i use for playing audios? |
20:02:42 | FromDiscord | <d4rckh> In reply to @Zoom "Does your IO benefit": what do you mean? |
20:03:05 | yoyojambo | why is there 'sort' and 'sorted' but no 'deduplicate' and 'deduplicated'? |
20:03:49 | FromDiscord | <Rika> https://nim-lang.org/docs/sugar.html#dup.m%2CT%2Cvarargs%5Buntyped%5D |
20:03:54 | FromDiscord | <Rika> because you can use this instead |
20:05:13 | yoyojambo | hmm |
20:05:34 | yoyojambo | but deduplicate already returns the sequence deduplicated |
20:05:48 | yoyojambo | i meant a procedure that works in-place |
20:06:13 | yoyojambo | instead of the current behavior |
20:06:41 | yoyojambo | of returning the copy |
20:07:23 | FromDiscord | <Zoom> I mean I still don't get why you split the file. You want to read the resulting multiple files in parallel?↵(@d4rckh) |
20:08:12 | FromDiscord | <Zoom> In which case, are you sure that reading the files is your bottlneck and reading in parallel makes a difference? |
20:08:16 | FromDiscord | <d4rckh> In reply to @Zoom "I mean I still": Yes, i need to split a large file in chunks and process it in parallel threads |
20:10:31 | FromDiscord | <Zoom> I got that. I don't get why you need it. What is the problem you're solving by splitting? Are the resulting file's contents ordered in some way and you want to preserve order for each thread?↵(@d4rckh) |
20:10:57 | FromDiscord | <d4rckh> I'm writing a web fuzzer |
20:13:47 | FromDiscord | <Rika> isnt "deduplicate" something to be used for inplace stuff? |
20:14:08 | yoyojambo | nope. returns a new sequence |
20:14:38 | yoyojambo | idk why it isn't called deduplicated |
20:15:26 | yoyojambo | sorta weird naming it's got going I guess |
20:16:40 | FromDiscord | <Zoom> That I see, it doesn't explain anything. Splitting a file may be required if each of the resulting will need a special treatment from the threads, or if there's some ordering constraints.↵(@d4rckh) |
20:17:57 | FromDiscord | <Zoom> You're reading the source file in a single thread, why not just send the data directly to worker threads. |
20:20:56 | FromDiscord | <huantian> In reply to @Knightmare Legion "Hello, could someone tell": just do `type S = object` |
20:23:47 | FromDiscord | <Yardanico> In reply to @yoyojambo "sorta weird naming it's": why? |
20:24:03 | FromDiscord | <Yardanico> ah right, for deduplicate you're right |
20:24:42 | NimEventer | New post on r/nim by Thadeu_de_Paula: https://github.com/thadeudepaula/ide.nvim.git, see https://reddit.com/r/nim/comments/u01grx/httpsgithubcomthadeudepaulaidenvimgit/ |
20:27:27 | nrds | <DarthOreo99> stil there even though acct deleted :P |
20:28:43 | NimEventer | New post on r/nim by Thadeu_de_Paula: Nim + NeoVim + Native LSP, see https://reddit.com/r/nim/comments/u01jo8/nim_neovim_native_lsp/ |
20:29:19 | FromDiscord | <Yardanico> In reply to @nrds "<DarthOreo> stil there even": you can't delete in IRC :) |
20:29:29 | FromDiscord | <Yardanico> and yes, the bot is too fast sometimes when people delete their posts |
20:32:54 | nrds | <DarthOreo99> It happens. We all done it. :) |
20:33:48 | FromDiscord | <Zoom> At the very least move the string alloc on ln42 out of the loop and reuse it.↵Doing `encodeUrl` in threads may also speed things up.↵(@d4rckh) |
20:34:33 | FromDiscord | <d4rckh> In reply to @Zoom "At the very least": Will do |
20:36:31 | * | SamuelMarks joined #nim |
20:41:21 | * | SamuelMarks quit (Ping timeout: 256 seconds) |
21:00:36 | FromDiscord | <TryAngle> sent a code paste, see https://paste.rs/fYP |
21:01:04 | FromDiscord | <Rika> most of us cant read rust code |
21:01:17 | FromDiscord | <Rika> im assuming this looks for processes with the names and thats it |
21:01:30 | FromDiscord | <TryAngle> yes basically iterating over all processes and get their pid |
21:01:38 | FromDiscord | <TryAngle> (edit) "yes basically iterating over all processes and get their pid ... " added "and name" |
21:02:35 | FromDiscord | <TryAngle> (edit) "yes basically iterating over all processes and get their pid and name ... " added "and their environment variables" |
21:04:46 | * | ltriant quit (Ping timeout: 272 seconds) |
21:05:30 | FromDiscord | <TryAngle> ah I found a port of psutils |
21:15:18 | FromDiscord | <!Patitotective> is there a way i could get an audio lenght in milliseconds? or play an audio until the end with https://github.com/paranim/parasound ?↵im using parasound and i need to `sleep(ms)` manually, and id like to be able to load different audio files with different lenghts↵https://play.nim-lang.org/#ix=3UII |
21:18:58 | * | dtomato quit (Quit: The Lounge - https://thelounge.chat) |
21:19:21 | * | dtomato joined #nim |
21:20:12 | * | SamuelMarks joined #nim |
21:22:27 | FromDiscord | <ITR> How can I tell what type a macro will return? It's listed as "untyped" and returns a function that has the return type "NimNode" |
21:25:18 | * | SamuelMarks quit (Ping timeout: 268 seconds) |
21:32:46 | * | ltriant joined #nim |
21:43:15 | * | wyrd quit (Ping timeout: 240 seconds) |
21:53:04 | FromDiscord | <Phil> Depends. A macro basically writes you code (or you can imagine it that way, strictly speaking IIRC it's the other way around), which can do a lot of different things. ↵With dot expressions you can literally tell it to write "myobj.someField", which, if "someField" is a static string that's passed into the macro, means the macro can't possibly know what field on "myobj" it will be accessing and thus not know which type there shall be |
21:53:43 | FromDiscord | <Phil> Therefore, if the macro is untyped you'll have to either comprehend what it does yourself to see whether that can be specified or it's a case where the actual type that comes out there could be anything |
21:54:12 | FromDiscord | <Phil> (edit) "that" => "you" | "be specified" => "replace the "untyped"" |
21:54:50 | FromDiscord | <Phil> (edit) "way, strictly speaking IIRC it's the other way around)," => "way)," |
21:55:16 | * | wyrd joined #nim |
21:59:21 | FromDiscord | <Elegantbeef> Macros return code |
21:59:25 | FromDiscord | <Elegantbeef> That's all you can say for certainty |
22:03:35 | FromDiscord | <Elegantbeef> To be fair passing by reference is a lent argument |
22:03:55 | FromDiscord | <Elegantbeef> Now if you could do it on a per proc basis without `var` it'd be nice |
22:07:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UIU |
22:12:21 | FromDiscord | <Zoom> Except it provides interior mutability. |
22:12:29 | FromDiscord | <Elegantbeef> What? |
22:12:36 | FromDiscord | <jmgomez> hey guys, when compiling a library that import headers that depends on another dll, how do you tell where they are? Using the passC argument or there is something else? If so, anyone knows what the one for ms? |
22:13:08 | FromDiscord | <Elegantbeef> Do you think i'm talking about `ref T`? |
22:13:57 | FromDiscord | <Elegantbeef> Nim generally does the cheapest operation on procedure calls, which means for larger objects to pass by reference, which is practically `lent` |
22:14:09 | FromDiscord | <Elegantbeef> I'm not talking about making a `ref object` |
22:14:33 | FromDiscord | <Elegantbeef> `--passL:"-LmyIncludePath"` |
22:15:01 | FromDiscord | <Elegantbeef> also or `-I` |
22:15:25 | FromDiscord | <jmgomez> but Im talking about the libraries needed to link |
22:15:46 | FromDiscord | <jmgomez> Not the headers |
22:15:47 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3UIW |
22:16:00 | FromDiscord | <Elegantbeef> Like i said `-L` |
22:16:39 | FromDiscord | <Elegantbeef> That adds a path to the linker, which it'll search for libraries |
22:16:45 | FromDiscord | <Elegantbeef> you might also need `-lMyLibName` |
22:16:53 | FromDiscord | <Zoom> Sorry, didn't get you. Still under the weather a bit. |
22:16:55 | FromDiscord | <Elegantbeef> I could be wrong about the issue though |
22:17:02 | FromDiscord | <Elegantbeef> Yea it's fine |
22:17:43 | FromDiscord | <jmgomez> ohh, ok. Sorry for the confusion |
22:20:51 | FromDiscord | <SirOlaf> I am back with a banger of a question. Does Nim have issues with really big files or something? I got about 200k lines of table initialization and it produces a binary that just kinda seems to abort |
22:21:23 | FromDiscord | <Elegantbeef> Nim doesnt have a problem with big files, are you perhaps misusing big files? |
22:21:37 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3UIX |
22:21:55 | FromDiscord | <Elegantbeef> I could be wrong not one for C/C++ compiler tinkering 😛 |
22:22:18 | FromDiscord | <jmgomez> the file should be .dll? |
22:22:38 | FromDiscord | <SirOlaf> In reply to @Elegantbeef "Nim doesnt have a": Well it's misused in the sense that it's not worth it because my compile time jumped to like 6 minutes instead of 10 seconds. But the point is that it produces a binary that when run does nothing even if I add echoes and whatever |
22:22:56 | FromDiscord | <jmgomez> no worries, any hint is worth it. I have been here for a long time, cant think with clarity anymore lol |
22:26:47 | * | SamuelMarks joined #nim |
22:29:43 | FromDiscord | <Elegantbeef> Welll what's the code olaf? |
22:29:55 | FromDiscord | <SirOlaf> Can send in a moment, am waiting for it to compile once more |
22:30:09 | FromDiscord | <Elegantbeef> Ok |
22:30:18 | FromDiscord | <SirOlaf> But it's a big generated file, obviously I wouldn't write 200k lines by hand |
22:30:37 | FromDiscord | <vSkyleX> Hi, I would like to know what are the control flows in NIM and if it has the sequential one. |
22:31:12 | FromDiscord | <Elegantbeef> It's Nim and it has the standard `if` `elif` `else` `case` `for` `while` |
22:31:23 | FromDiscord | <Elegantbeef> "the sequential one"? |
22:31:26 | * | Gustavo6046 joined #nim |
22:32:16 | FromDiscord | <vSkyleX> In reply to @Elegantbeef ""the sequential one"?": user actions and computer logic that initiate, interrupt, or terminate transactions. |
22:33:00 | FromDiscord | <vSkyleX> does it execute code line by line or it reads the entire thing then it executes the code |
22:33:12 | FromDiscord | <Elegantbeef> It's compiled |
22:33:22 | FromDiscord | <vSkyleX> sequential means it executes it line by line |
22:33:38 | FromDiscord | <Elegantbeef> It's an imperative compiled language |
22:33:54 | FromDiscord | <SirOlaf> sent a code paste, see https://play.nim-lang.org/#ix=3UIZ |
22:33:56 | FromDiscord | <SirOlaf> With my big generated file |
22:34:05 | FromDiscord | <vSkyleX> In reply to @Elegantbeef "It's an imperative compiled": gotcha thanks |
22:35:17 | FromDiscord | <Elegantbeef> I'm a bit confused why you have a file that's 200k lines, but nim should handle it fine |
22:35:24 | FromDiscord | <SirOlaf> I told you it's generated |
22:35:31 | FromDiscord | <SirOlaf> From a file that's even bigger |
22:35:45 | FromDiscord | <Elegantbeef> Eitherway can i see the file? |
22:36:04 | FromDiscord | <SirOlaf> Yeah, one second, gotta see what it depends on, it's a bit messy |
22:36:23 | FromDiscord | <SirOlaf> https://media.discordapp.net/attachments/371759389889003532/962481125173899274/wiztypedefs.nim https://media.discordapp.net/attachments/371759389889003532/962481125408796752/wiztypegen.nim |
22:36:57 | FromDiscord | <SirOlaf> Ignore non-idiomatic stuff or whatever |
22:37:03 | FromDiscord | <SirOlaf> Point is the big initialization |
22:37:18 | FromDiscord | <yoyojambo> is there any known bug that makes lowerBound return a very off index? |
22:37:23 | FromDiscord | <Elegantbeef> I'm just amazed this is a raw file 😛 |
22:37:47 | FromDiscord | <SirOlaf> Sometimes you just gotta do what you gotta do 😼 |
22:37:58 | FromDiscord | <Elegantbeef> You arent even using macros api, jeez you're a masochist |
22:38:16 | FromDiscord | <SirOlaf> I'm scared of how brutal the compiletimes might get with macros |
22:38:23 | FromDiscord | <SirOlaf> If this is already 6 minutes |
22:38:51 | FromDiscord | <Elegantbeef> I meant for the code gen |
22:38:55 | FromDiscord | <SirOlaf> Oh |
22:39:17 | FromDiscord | <SirOlaf> Yeah just did some old-fashioned magic because I got no idea how else to do it |
22:39:41 | FromDiscord | <Elegantbeef> Runs fine here |
22:39:52 | FromDiscord | <SirOlaf> That's odd |
22:39:53 | FromDiscord | <Elegantbeef> Took like 10s to compile and ran |
22:39:53 | FromDiscord | <Elegantbeef> `nim -v`? |
22:39:57 | FromDiscord | <Elegantbeef> Sorry 25s |
22:40:21 | FromDiscord | <SirOlaf> Am on devel, but tried stable as well |
22:40:47 | FromDiscord | <Elegantbeef> OS? |
22:40:50 | FromDiscord | <SirOlaf> Windows |
22:40:52 | FromDiscord | <SirOlaf> 10 |
22:41:00 | FromDiscord | <Elegantbeef> Yea even the `$` of the output works |
22:41:18 | FromDiscord | <SirOlaf> What is the code you're running? |
22:41:19 | FromDiscord | <Elegantbeef> Are you sure you compiled `wiztypegen`? |
22:41:34 | FromDiscord | <jmgomez> In reply to @Elegantbeef "I could be wrong": you were absolutely right! Thanks a ton. It does compile now 🙂 |
22:41:35 | FromDiscord | <Elegantbeef> `echo "hello"; echo wizTypeRegistry` |
22:41:53 | FromDiscord | <Elegantbeef> Fuck i might be smarter than i think! |
22:43:27 | * | vicfred joined #nim |
22:45:03 | FromDiscord | <SirOlaf> Can the vm or something time out |
22:45:13 | FromDiscord | <SirOlaf> Because it does not want to work for me |
22:45:30 | FromDiscord | <Elegantbeef> What's your CPU? |
22:45:36 | FromDiscord | <Elegantbeef> You said it compiles |
22:45:37 | FromDiscord | <SirOlaf> 2700x |
22:45:43 | FromDiscord | <SirOlaf> Yeah it compiles, but takes 6 minutes |
22:45:47 | FromDiscord | <Elegantbeef> Yea you have a higher IPC than me iirc |
22:46:15 | FromDiscord | <Elegantbeef> You are just compiling `wiztypegen` right? |
22:46:16 | FromDiscord | <Elegantbeef> The one with 200k loc |
22:46:32 | FromDiscord | <SirOlaf> I tried importing it and I tried adding code to the big file |
22:46:41 | FromDiscord | <SirOlaf> Both options produce something that does not work |
22:46:54 | FromDiscord | <SirOlaf> And takes forever to compile |
22:47:01 | FromDiscord | <Elegantbeef> Well i dont know what to say, try a different C compiler |
22:47:08 | FromDiscord | <Elegantbeef> If that doesnt change anything try WSL2 |
22:47:24 | FromDiscord | <Elegantbeef> If that doesnt change anything, i dont know cry or something |
22:50:52 | FromDiscord | <SirOlaf> What gc did you use |
22:51:01 | FromDiscord | <SirOlaf> Because it does seem to work with refc |
22:52:06 | FromDiscord | <SirOlaf> So may just be another arc bug |
22:53:06 | FromDiscord | <SirOlaf> Yeah that seems to be it, switching back to arc makes it produce trash again |
22:53:21 | FromDiscord | <Elegantbeef> Works fine |
22:53:29 | FromDiscord | <SirOlaf> With arc? |
22:53:40 | FromDiscord | <Elegantbeef> Takes a bit to compile like 30s but works ifne |
22:53:51 | FromDiscord | <SirOlaf> Well it breaks for me |
22:53:56 | FromDiscord | <SirOlaf> That's odd |
22:54:21 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
22:54:55 | FromDiscord | <SirOlaf> I can switch back and forth and it just works™️ with refc |
22:57:38 | FromDiscord | <SirOlaf> According to x64dbg it crashes with a stack overflow |
22:58:46 | FromDiscord | <SirOlaf> So I guess that explains why it may not happen for everyone |
22:59:50 | FromDiscord | <SirOlaf> This means the next question I have is why arc uses more stack space |
23:02:37 | FromDiscord | <Elegantbeef> Might need to increase your stacksize |
23:03:08 | FromDiscord | <Elegantbeef> Dont recall if a Nim flag for it exists |
23:03:15 | FromDiscord | <Phil> Huh.... my web application compiles with both default, arc and orc... guess I'll stick with arc because it's almost arch |
23:03:40 | FromDiscord | <SirOlaf> Well can pass to c compiler I guess, but why does it use so much/infer the wrong size in the first place |
23:05:14 | FromDiscord | <auxym> In reply to @Isofruit "Huh.... my web application": fyi, if you have cyclic refs and use arc, you will have memory leaks. that's the reason for orc's existence. |
23:06:24 | FromDiscord | <Phil> In reply to @auxym "fyi, if you have": Fair point! Hmmm well I guess the extra security will be pretty nice. I don't think there are any cyclical dependencies, but I could be wrong |
23:08:08 | FromDiscord | <Elegantbeef> Dont ask me it works here 😜↵(@SirOlaf) |
23:08:31 | FromDiscord | <Elegantbeef> use `--gc:arc -d:useMalloc` and valgrind it↵(@Phil) |
23:08:35 | FromDiscord | <Elegantbeef> If you leak use orc and try again |
23:08:56 | FromDiscord | <Elegantbeef> If you still leak you have an orc bug |
23:09:19 | FromDiscord | <Phil> But then I'd actually have to check if I leak memory |
23:09:55 | FromDiscord | <Elegantbeef> true |
23:10:33 | FromDiscord | <Phil> Wait, wasn't it `--mm:arc` ? |
23:11:11 | FromDiscord | <Elegantbeef> same thing |
23:11:20 | FromDiscord | <Elegantbeef> Pre 1.6 it was `gc` |
23:13:07 | FromDiscord | <SirOlaf> Epic, my code works with 500MB stack |
23:13:27 | FromDiscord | <Elegantbeef> Bit fucking big dont you think 😛 |
23:13:39 | FromDiscord | <Phil> what happens if I do orc with usemalloc?↵I mean, that makes use of C's memory allocation... I'm not sure what that actually changes, fundamentally speaking |
23:14:05 | FromDiscord | <Elegantbeef> Nim's allocator doesnt return memory to OS, so valgrind doesnt know what a leak is |
23:14:14 | FromDiscord | <Elegantbeef> Valgrind works with malloc |
23:14:17 | FromDiscord | <SirOlaf> In reply to @Elegantbeef "Bit fucking big dont": Go big or go home |
23:14:48 | FromDiscord | <SirOlaf> 5MB does seem to be enough though |
23:15:24 | FromDiscord | <Elegantbeef> Are you using mingw? |
23:15:39 | FromDiscord | <SirOlaf> Me? I'm on gcc |
23:15:46 | FromDiscord | <SirOlaf> So I guess yes |
23:16:25 | FromDiscord | <Elegantbeef> Seems mingw doesnt work like normal gcc with stack |
23:16:30 | FromDiscord | <Elegantbeef> So explains why my gcc doesnt error but mingw does |
23:16:43 | FromDiscord | <SirOlaf> Probably just has higher default size |
23:17:35 | FromDiscord | <Elegantbeef> Yea i dont know i've never had stack issues so i think gcc has better sizing mechanisms |
23:17:45 | FromDiscord | <SirOlaf> Also fixed my compile time, so linker was seemingly just dying |
23:18:18 | FromDiscord | <Elegantbeef> Ah nice |
23:18:20 | FromDiscord | <TryAngle> @ElegantBeef u had a zip that accepted more than 2 right? may u link me it please 🥺 |
23:19:11 | FromDiscord | <Elegantbeef> https://github.com/beef331/slicerator/blob/master/src/slicerator.nim#L151 |
23:19:49 | FromDiscord | <Elegantbeef> https://github.com/beef331/slicerator/blob/master/src/slicerator.nim#L278 |
23:20:24 | FromDiscord | <TryAngle> zipIter is faster right? |
23:20:27 | FromDiscord | <Elegantbeef> The last can be more memory efficient |
23:20:43 | FromDiscord | <Elegantbeef> Depends on the use case |
23:20:59 | FromDiscord | <Elegantbeef> "can be" |
23:21:09 | FromDiscord | <TryAngle> is slicerator up to date on nimble? |
23:22:01 | FromDiscord | <Elegantbeef> Say you pass in an iterator of `0..100` and `0..10` with a normal algorithm you iterate 100 times then 10 times and resize the sequence to 10, with that iterator you convert the iterators to closures then iterate until the first one is finished |
23:22:05 | FromDiscord | <Elegantbeef> So it's 10 iterations instead |
23:22:10 | FromDiscord | <Elegantbeef> It's on nimble |
23:22:49 | FromDiscord | <TryAngle> ah I see 🤔 |
23:22:51 | FromDiscord | <TryAngle> thanks |
23:23:27 | FromDiscord | <Elegantbeef> It also can be more memory efficient since it copies the input data and doesnt make a large sequence |
23:23:28 | FromDiscord | <Elegantbeef> But this is all 'can' and it's not always faster than the `sequtils` zip |
23:23:30 | FromDiscord | <Elegantbeef> the sequtils zip takes in collections and as such they're fixed size, which means this can be done easily |
23:24:45 | FromDiscord | <Elegantbeef> I can make cases where either is faster or more memory efficient, case by case matters |
23:25:28 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3UJ1 |
23:26:02 | FromDiscord | <Elegantbeef> `.items` |
23:26:32 | FromDiscord | <TryAngle> ah, ok what does .items do? |
23:26:36 | FromDiscord | <TryAngle> return an iterator? |
23:26:42 | FromDiscord | <Elegantbeef> yes |
23:26:59 | FromDiscord | <SirOlaf> Got another, less convoluted question. Why does this crash if you set the stream position to say 0 and then call write? https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/streams.nim#L1248 |
23:27:18 | FromDiscord | <spoon> hmm, why does iterating backwards using `for i in 10..1` not work? is that a design choice? |
23:27:28 | FromDiscord | <Elegantbeef> Yes |
23:27:39 | FromDiscord | <Elegantbeef> a range of `10..1` doesnt have any elements |
23:27:45 | FromDiscord | <Elegantbeef> `countDown(10, 1)` |
23:28:19 | FromDiscord | <Elegantbeef> It increases the cost of a simple `0..10` since it has to check if `a > b` |
23:28:49 | FromDiscord | <Elegantbeef> Olaf there is very little reason for a crash there |
23:29:34 | FromDiscord | <SirOlaf> Crashes for me |
23:29:35 | FromDiscord | <SirOlaf> sent a code paste, see https://play.nim-lang.org/#ix=3UJ3 |
23:29:47 | FromDiscord | <Elegantbeef> Runs fine here |
23:30:00 | FromDiscord | <SirOlaf> Are we just using different nims here |
23:30:08 | FromDiscord | <SirOlaf> How come everything works for you |
23:30:20 | FromDiscord | <Elegantbeef> Ah arc it crashes |
23:30:27 | FromDiscord | <SirOlaf> Ok good, I'm not just crazy |
23:30:40 | FromDiscord | <vSkyleX> Does Nim offer aliasing? |
23:31:00 | FromDiscord | <huantian> aliasing of variables? |
23:31:07 | FromDiscord | <vSkyleX> yup |
23:31:56 | FromDiscord | <SirOlaf> Found this stream crash when I was comparing a really bad custom bytestream to it |
23:32:11 | FromDiscord | <SirOlaf> So I wanted to switch but couldn't |
23:32:14 | FromDiscord | <Elegantbeef> This is really odd |
23:33:50 | FromDiscord | <Elegantbeef> Depends what you're doing but yea |
23:33:50 | FromDiscord | <huantian> probably just use a ref type, I think?↵(@vSkyleX) |
23:33:51 | FromDiscord | <Elegantbeef> Think it's something to do with the `sink` |
23:34:01 | * | yoyojambo quit (Quit: Leaving) |
23:34:15 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/streams.nim#L1255 from here |
23:34:54 | FromDiscord | <Elegantbeef> Make an issue for it olaf if one doesnt exist "Creating a string stream with a string nil refs on write" |
23:35:15 | FromDiscord | <SirOlaf> Ok sure |
23:35:44 | FromDiscord | <Elegantbeef> You dont even need to set position |
23:36:00 | FromDiscord | <SirOlaf> Yeah I think it doesn't set it on init like that |
23:36:07 | FromDiscord | <Elegantbeef> Does it too |
23:36:10 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UJ5 |
23:36:11 | FromDiscord | <SirOlaf> But I do it anyways because that's the example I was gonna use it for |
23:36:20 | FromDiscord | <Elegantbeef> It's an issue with `sink`i think |
23:36:20 | FromDiscord | <Elegantbeef> So mention `arc` |
23:37:53 | FromDiscord | <Elegantbeef> it's odd that there are no tests that have caught this bug |
23:38:19 | FromDiscord | <SirOlaf> Well imagine my surprise when it failed, really seemed like something that would just work |
23:38:47 | FromDiscord | <Elegantbeef> It errors all the way back to `1.2.x` |
23:38:50 | FromDiscord | <Elegantbeef> So yea something is just wrong there |
23:39:07 | FromDiscord | <Elegantbeef> to work around it just dont pass a string then do `s.write` |
23:39:45 | * | SamuelMarks quit (Ping timeout: 246 seconds) |
23:43:43 | FromDiscord | <SirOlaf> Guess that works, but a tiny bit of extra work for my use case |
23:44:53 | FromDiscord | <SirOlaf> And not an obscure bug for once, I could see someone run into this one |
23:47:05 | FromDiscord | <Elegantbeef> Well it's obscure in that i dont see exactly what causes it, i replicated the logic and no error |
23:47:44 | FromDiscord | <SirOlaf> Always nice when reproducing it is hard |
23:48:19 | FromDiscord | <Yardanico> @ElegantBeef maybe for some reason Nim is not calling prepareMutation for the stream string? |
23:48:29 | FromDiscord | <Elegantbeef> Perhaps |
23:48:31 | FromDiscord | <Yardanico> yeah i think so |
23:48:34 | FromDiscord | <Yardanico> doesn't crash |
23:48:42 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3UJ9 |
23:49:00 | FromDiscord | <Elegantbeef> sink + copymem alias that away? |
23:49:06 | FromDiscord | <Yardanico> but again, looks like streams only does it with `copyMem` so nim really has no way of knowing the proc wants to modify that |
23:49:14 | FromDiscord | <Yardanico> so maybe it needs to be inserted in streams explicitly |
23:49:49 | FromDiscord | <Yardanico> that's actually documented in https://nim-lang.org/docs/destructors.html#copy-on-write |
23:49:54 | FromDiscord | <SirOlaf> Anyways, issue has been made, so my job here is done 😼 |
23:50:07 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UJa |
23:50:09 | FromDiscord | <Elegantbeef> That errors of course |
23:50:42 | FromDiscord | <Elegantbeef> Ah so inside `newStringStream` it needs a `prepareMutation` |
23:51:08 | FromDiscord | <Yardanico> yes |
23:51:18 | FromDiscord | <Elegantbeef> Well yardanico you found the fix you PR the fix 😛 |
23:51:24 | FromDiscord | <Yardanico> noo you do it |
23:51:32 | FromDiscord | <Yardanico> im going to sleep anyway |
23:51:33 | FromDiscord | <Elegantbeef> No you! |
23:51:35 | FromDiscord | <Yardanico> 2:50 AM!! |
23:51:47 | FromDiscord | <Elegantbeef> Psh 10 minutes until 3 plenty of time |
23:52:30 | FromDiscord | <huantian> Submitting PRs at 3AM (GONE WRONG!) |
23:52:39 | FromDiscord | <Elegantbeef> Gone sexual\ |
23:53:04 | FromDiscord | <Elegantbeef> Jeez yard really really wants me to fix it even thanked me in the issue |
23:53:07 | FromDiscord | <Elegantbeef> Fucking asshole |
23:53:32 | FromDiscord | <Elegantbeef> Jokes aside, nighty night |