00:42:37 | * | vicfred joined #nim |
00:50:31 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
00:50:50 | * | njoseph joined #nim |
01:03:30 | * | jjido quit (Quit: Connection closed for inactivity) |
02:18:24 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
02:40:18 | FromDiscord | <Edwin> sent a code paste, see https://play.nim-lang.org/#ix=2UMr |
02:42:14 | FromDiscord | <ElegantBeef> do `.repr` instead |
02:44:00 | FromDiscord | <ElegantBeef> Atleast assuming this is for debugging |
02:47:05 | FromDiscord | <Edwin> i will try that! i am trying to access the member `pw_name` of `passwd` for regular code (since i couldn't seem to find the file owner with the builtin functions), so i don't think this is strictly for ust debugging |
02:47:08 | FromDiscord | <Edwin> (edit) "ust" => "just" |
02:52:56 | FromDiscord | <ElegantBeef> Ah your cast might be the culprit |
02:53:02 | FromDiscord | <ElegantBeef> Do `file.id.file.uint32` |
02:55:06 | FromDiscord | <Edwin> Hmm, both `getpwuid(cast[uint32](file.id.file))` and `getpwuid(file.id.file.uint32)` seem to be yielding the same output with repr |
02:55:25 | FromDiscord | <ElegantBeef> Well the cast is unsafe and almost certainly not what you want |
02:55:58 | FromDiscord | <Edwin> I see, I guess I won't be using the cast then |
02:56:48 | FromDiscord | <Edwin> sent a code paste, see https://play.nim-lang.org/#ix=2UMt |
02:57:41 | FromDiscord | <ElegantBeef> Are you using the `posix` module or your own code? |
02:58:03 | FromDiscord | <ElegantBeef> Ah i'm blind |
03:01:29 | FromDiscord | <ElegantBeef> Ok so it seems `getpwuid` uses a user ID not a file id, which is where this issue is coming from |
03:02:45 | FromDiscord | <Edwin> ahh, so then it makes sense that the `file.id.file.uint32` wasn't working |
03:02:51 | FromDiscord | <ElegantBeef> Yep |
03:04:30 | FromDiscord | <ElegantBeef> Though the stat method should work |
03:07:37 | FromDiscord | <Edwin> yeah, just to make sure i'm not totally out of it, i did it in c and there weren't any errors or anything, worked perfectly fine |
03:08:01 | FromDiscord | <ElegantBeef> Yea i just replicated the issue |
03:08:24 | FromDiscord | <ElegantBeef> Well it's not an issue rather it works |
03:08:44 | FromDiscord | <ElegantBeef> Repr doesnt return the object it's represented by `[]` apparently |
03:09:08 | FromDiscord | <ElegantBeef> So you can now access the field you want |
03:09:34 | FromDiscord | <Edwin> OMG i just realized! |
03:10:12 | FromDiscord | <Edwin> that is what i'm looking for |
03:10:18 | FromDiscord | <Edwin> thank you so much! |
03:10:24 | FromDiscord | <Edwin> i suppose i'm fine with the repr thing for now :P |
03:10:35 | FromDiscord | <ElegantBeef> You're welcome always nice to lead people down the wrong path! |
03:36:00 | * | spiderstew joined #nim |
03:38:26 | * | spiderstew_ quit (Ping timeout: 240 seconds) |
03:54:50 | * | NimBot joined #nim |
04:28:00 | * | NimBot joined #nim |
05:08:24 | * | narimiran joined #nim |
05:37:15 | * | vicfred quit (Quit: Leaving) |
06:37:06 | * | aeverr quit (Ping timeout: 240 seconds) |
07:00:43 | * | filcuc joined #nim |
07:21:57 | * | kostrak[m] joined #nim |
07:29:38 | * | filcuc quit (Quit: Konversation terminated!) |
07:29:53 | * | filcuc joined #nim |
07:32:56 | * | filcuc quit (Client Quit) |
07:33:08 | * | filcuc joined #nim |
07:37:59 | * | filcuc quit (Ping timeout: 265 seconds) |
07:42:53 | * | hed0n1st joined #nim |
07:47:54 | * | hed0n1st quit (Quit: Leaving) |
07:49:08 | FromDiscord | <flywind> https://github.com/nim-lang/Nim/issues/17392 |
07:49:27 | FromDiscord | <flywind> Can someone help me test this issue? |
07:49:40 | FromDiscord | <flywind> (edit) removed "help me" |
07:49:47 | FromDiscord | <flywind> (edit) "Can someone ... test" added "else" |
07:57:25 | * | kostrak[m] left #nim ("User left") |
08:06:37 | * | pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
08:07:35 | * | pbb joined #nim |
08:12:32 | ForumUpdaterBot | New thread by Miran: This Month with Nim: March 2021, see https://forum.nim-lang.org/t/7737 |
09:00:10 | * | ee7[m] quit (Quit: Idle for 30+ days) |
09:26:14 | * | lritter joined #nim |
10:10:07 | * | waleee-cl joined #nim |
10:10:54 | FromDiscord | <jtiai> How should I go with bitfields? Like I have `uint32` value which I'm only interested in bits 0, 1, 2 and 16. |
10:15:59 | FromDiscord | <zetashift> @jtiai maybe this: https://nim-lang.org/docs/manual.html#set-type-bit-fields ? |
10:17:27 | FromDiscord | <jtiai> I read that but couldn't find anything that would say how to skip/define bitsets that I'm not interested in. |
10:22:08 | FromDiscord | <jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2UNJ |
10:26:20 | FromDiscord | <Rika> Set the value |
10:26:28 | FromDiscord | <Rika> D = 16 |
10:26:43 | FromDiscord | <Rika> It will reflect in the bit field |
10:27:07 | FromDiscord | <Rika> Note that the first element will be bit zero regardless of the value |
10:37:25 | FromDiscord | <Rika> Oh forgot, “bit fields are 1 indexed” (not really) |
10:39:47 | * | aeverr joined #nim |
11:06:51 | * | haxscramper joined #nim |
11:15:41 | FromGitter | <HJarausch_gitlab> Layout of the Duration object? ⏎ According to the docs ⏎ ⏎ ```code paste, see link``` ⏎ ... [https://gitter.im/nim-lang/Nim?at=6066fcdd92a3431fd66e68fa] |
11:20:23 | * | narimiran quit (Ping timeout: 252 seconds) |
11:33:44 | FromGitter | <Clyybber> I think seconds is not exported |
11:34:28 | FromGitter | <Clyybber> @HJarausch_gitlab Btw, can you test if https://github.com/nim-lang/Nim/pull/17574 works for you? |
11:37:29 | FromGitter | <HJarausch_gitlab> Thanks! Is there any means to convert a Duration object to a float value? ⏎ ⏎ And w.r.t. nim-lang/Nim#17574 I currently cannot test it since it occurred during compilation of Weave. ⏎ But, unfortunately, Nim-Devel cannot compile Weave any more. I try to find some means to test it. [https://gitter.im/nim-lang/Nim?at=606701f8657d022d5a59e22c] |
11:59:00 | liblq-dev | any reason for why --exceptions:goto is not the default? |
12:06:49 | FromGitter | <Clyybber> @HJarausch_gitlab Use the inMilliseconds/inMicroseconds to get the duration as an int in that unit, then convert that to a float and scale it to seconds |
12:07:02 | FromDiscord | <clyybber> liblq-dev: AFAIR it's the default for gc:arc |
12:07:13 | liblq-dev | ah yes, the default for gc:arc. |
12:07:20 | liblq-dev | BUT GC:ARC IS NOT THE DEFAULT GC!!!!!!!!!! |
12:07:38 | liblq-dev | what's preventing --exceptions:goto from becoming the default exception model on all GCs? |
12:08:19 | liblq-dev | https://github.com/liquidev/datarray#benchmarks |
12:09:19 | FromDiscord | <clyybber> liblq-dev: Nothing afaik, it's just that it has different performance characteristics |
12:15:41 | FromDiscord | <no name fits> Is there a way to see what the type of the error that gets raised, is? |
12:16:06 | liblq-dev | what would be your use case for that? |
12:16:32 | liblq-dev | asking because there are a few ways |
12:17:00 | FromDiscord | <no name fits> I want to try out the assertRaise thingy |
12:17:09 | FromDiscord | <no name fits> But I have no idea which error I'm actually expecting |
12:18:26 | liblq-dev | idk, look at the raising proc's documentation to see what {.raises: […].} pragmas it has? |
12:19:47 | FromDiscord | <no name fits> Alright, thanks |
12:20:32 | liblq-dev | i mean i'm just throwing ideas around :p if that doesn't work, you can try echoing `yourException.name` |
12:20:56 | FromDiscord | <no name fits> so catching it and printing the name |
12:21:06 | liblq-dev | yeah |
12:22:01 | haxscramper | liblq-dev: do you have benchmarks for 'unoptimized' version of the code from readme example? I.e. with just `Datarray[1000, Ant]`. |
12:22:33 | haxscramper | Or is it there but I just missed it |
12:22:48 | liblq-dev | the benchmarks use pretty much the same code but the size is 1000000 |
12:23:07 | liblq-dev | https://github.com/liquidev/datarray/blob/master/src/datarray.nim#L314 |
12:35:33 | * | filcuc joined #nim |
12:55:32 | * | filcuc quit (Ping timeout: 265 seconds) |
13:02:29 | * | MeMeNim joined #nim |
13:03:29 | * | filcuc joined #nim |
13:05:01 | * | MeMeNim quit (Read error: Connection reset by peer) |
13:10:46 | ForumUpdaterBot | New post on r/nim by XxDiCaprioxX: Tuples vs. Objects, see https://reddit.com/r/nim/comments/mik0wx/tuples_vs_objects/ |
13:12:40 | * | MeMeNim joined #nim |
13:14:02 | * | filcuc quit (Ping timeout: 260 seconds) |
13:14:57 | * | MeMeNim quit (Read error: Connection reset by peer) |
13:17:47 | FromGitter | <HJarausch_gitlab> @Clyybber I just applied your patch to threadlocalstorage.nim to Nim-1.4.4. Then I tried to compile Weave. I get the compilation error ⏎ ⏎ `````` [https://gitter.im/nim-lang/Nim?at=6067197a89446618e9802d5a] |
13:19:40 | FromGitter | <Clyybber> @HJarausch_gitlab Are you sure you also included https://github.com/nim-lang/Nim/pull/17574/commits/3a3ca62c5a35ba3583f6a030dbaa1f9b937c25c7 ? |
13:19:44 | FromGitter | <Clyybber> It's part of the PR |
13:28:09 | FromGitter | <HJarausch_gitlab> Thanks, I've missed that. Now, it compiles and runs just fine. I don't know how to check if a given thread is *bound* to a fixed cpu/core now. Now, I hope that Nim Devel will be able to compile Weave soon. Unfortunately, Weave is quite complex so that it will be difficult for me to narrow down the code which triggers this Nim compiler bug. |
13:34:18 | FromDiscord | <no name fits> Is there a cheat-sheet for string manipulation somewhere? |
13:34:58 | liblq-dev | https://nim-lang.org/docs/strutils.html i guess |
13:35:09 | FromDiscord | <no name fits> alright |
13:56:24 | FromGitter | <xflywind> @Helmut Jarausch you should use https://nim-lang.org/docs/times.html#inSeconds%2CDuration |
13:56:40 | FromGitter | <xflywind> to access seconds attributes. |
14:28:25 | * | wasted_youth2 quit (Read error: Connection reset by peer) |
14:28:49 | * | wasted_youth2 joined #nim |
14:32:31 | FromDiscord | <no name fits> sent a code paste, see https://play.nim-lang.org/#ix=2UP2 |
14:32:44 | FromDiscord | <lantos> ffff, getting segfaults and can't work out why. 😦 |
14:33:10 | FromDiscord | <no name fits> I tried putting it into the playground with some test HTML, and it works, but I have no idea how |
14:33:41 | FromDiscord | <lantos> (edit) "ffff, getting segfaults and can't work out why. 😦 ... " added "Anyone who knows how to debug this pleasa helpa" |
14:34:10 | FromDiscord | <Yardanico> what exactly do you not understand here? |
14:34:32 | FromDiscord | <no name fits> Mostly the part involving the actual scanp call |
14:34:47 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/827551640164761610/unknown.png |
14:35:06 | FromDiscord | <no name fits> Yeah I read that one, but I'm still struggling to put it all together |
14:36:27 | * | guelosk[m] joined #nim |
14:36:35 | FromDiscord | <no name fits> So I get that it seems to start at the "<a" skip until the "href=", stop at the ">" and then the rest looks magic to me |
14:37:07 | FromDiscord | <no name fits> I also don't get why it's $input and $index |
14:38:14 | FromDiscord | <Yardanico> just because it's not documented enough :) |
14:38:23 | FromDiscord | <Yardanico> those are replaced by scanp https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/strscans.nim#L502 automatically |
14:38:38 | FromDiscord | <no name fits> ohhh |
14:38:41 | FromDiscord | <no name fits> Alright |
14:39:26 | FromDiscord | <Yardanico> quoting is a shorter way of creating an atom https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/strscans.nim#L596 |
14:39:34 | FromDiscord | <Yardanico> with back quotes I mean |
14:40:33 | FromDiscord | <Yardanico> as something a bit similar to strscans you might also try https://github.com/zevv/npeg for more complex parsers |
14:41:22 | FromDiscord | <no name fits> Cool, thanks. |
14:47:22 | FromDiscord | <no name fits> sent a long message, see https://paste.rs/1kj |
14:47:39 | FromDiscord | <no name fits> There might be any number of bracket pairs, anywhere in the string |
14:49:54 | FromDiscord | <Yardanico> does strformat not work for you? |
14:50:01 | FromDiscord | <Yardanico> it has a similar purpose I mean |
14:50:02 | FromDiscord | <Yardanico> kind of |
14:50:03 | FromDiscord | <no name fits> It might. I have no idea what I'm doing |
14:50:16 | FromDiscord | <no name fits> I'm basically trying to make a templating engine for web |
14:50:17 | FromDiscord | <Yardanico> what do you need this for? |
14:50:19 | FromDiscord | <Yardanico> oh |
14:50:50 | FromDiscord | <no name fits> Right now I'm just trying to even get what's within the brackets lol |
14:54:25 | FromGitter | <bung87> execCmdEx has previous outputs ? |
14:55:05 | FromGitter | <bung87> I can parse `nimble dump --json` , previous output `Warning: Using project local deps mode` |
14:55:10 | FromGitter | <bung87> can't |
15:16:46 | FromGitter | <bung87> nvm |
15:18:00 | FromDiscord | <zetashift> @leorize using your plugin in neovim, the syntax highlighting kind of "drags" along as I type, anyway to disable this behavior? |
15:18:27 | liblq-dev | nope |
15:18:36 | liblq-dev | welcome to nimsuggest™ |
15:20:10 | FromDiscord | <Yardanico> if I have an array[ThreadCount, seq[string]] and add to those seqs from different threads (each index is only owned by a single thread), is it thread-safe under ARC/ORC ? |
15:20:25 | FromDiscord | <Yardanico> since there can be no data races as I understand |
15:25:38 | FromDiscord | <Yardanico> maybe I should try using new std/channels 🤔 |
15:25:57 | FromDiscord | <Conifer> Could someone sell the idea of using Nim for me? Having difficult time choosing Nim or going back to Lua for gamedev (Lua with Love2D) albeit Lua's tables are driving me to suicidal thoughts. Anywhere I can read solid examples of Pros & Cons of Nim? |
15:27:14 | leorize[m] | @zetashift it can't be done instantly, so some form of "dragging" has to occur. Do you want to customize it so that it only updates when you stop typing or smt? |
15:31:00 | liblq-dev | @Conifer pros: static type system, metaprogramming with code introspection capabilities, speed |
15:31:11 | liblq-dev | cons: compiler can be unstable and/or slow at times |
15:31:41 | FromDiscord | <exelotl> Yeah what lqdev said |
15:31:49 | leorize[m] | Yardanico yes, it should be safe |
15:32:37 | leorize[m] | now if you are gonna read from those from different threads, then you need a lock |
15:32:58 | FromDiscord | <exelotl> About static/dynamic typung: I used to not care, then I wrote games in JS for 2 years and now I think the confidence that a statically typed language gives you, being able to catch mistakes before your code even builds, is extremely valuable for any sizeable project |
15:33:10 | FromDiscord | <exelotl> (edit) "typung:" => "typing:" |
15:33:15 | liblq-dev | yeah what exelotl said |
15:33:39 | liblq-dev | i still like lua for static prototyping but sometimes i find it hard to catch errors related to nim access |
15:33:45 | liblq-dev | s/static/fast |
15:33:49 | liblq-dev | s/nim/nil |
15:34:13 | * | Vladar joined #nim |
15:34:23 | liblq-dev | forgive my brain being on airplane mode, i spent the past hour or two trying to figure out why the heck hoisting my code to another module slows it down. |
15:34:29 | FromDiscord | <zetashift> In reply to @leorize "<@77574388035100672> it can't be": yeah that! |
15:34:49 | FromDiscord | <Conifer> Yeah I get the idea of static typing. Used Go before but it started to become unrepairable mess and there are bits I hate there as well so I agree.↵↵Gonna play around with nim |
15:34:52 | FromDiscord | <Conifer> and see how it is |
15:35:07 | liblq-dev | nim's type system is considerably better than go's thanks to generics |
15:35:32 | leorize[m] | also we have distinct types |
15:35:38 | liblq-dev | go also has distinct types |
15:35:45 | liblq-dev | afaik |
15:35:52 | liblq-dev | haven't delved too deep into it |
15:36:05 | leorize[m] | I never knew that :p |
15:36:24 | FromDiscord | <Conifer> Go will have generics tho |
15:36:28 | liblq-dev | i think making a type alias to another type acts like distinct but idk |
15:36:34 | liblq-dev | like `type foo int` |
15:36:50 | liblq-dev | i don't like go sooooooooooooooooo |
15:36:52 | FromDiscord | <exelotl> Oh yeah Go's type system is not great... It doesn't even have enums 😅 |
15:37:02 | Prestige | Dang really? |
15:37:04 | liblq-dev | enums in go are icky |
15:37:10 | liblq-dev | you use this weird iota thing |
15:37:14 | leorize[m] | @zetashift I'll push an update in a few mins with a switch for this, this feature has been requested for awhile :p |
15:37:15 | liblq-dev | whatever "iota" even means. |
15:37:49 | * | liblq-dev < https://matrix.org/_matrix/media/r0/download/matrix.org/GWTVeWuTiQdXtsVpwAzGkKbH/message.txt > |
15:41:07 | Zoom[m] | Hey everyone. I asked a couple of days ago, but the channel was kinda slow. Does anyone have ideas in regards to Nim being considerably slower than Go in that countwords thingy? |
15:41:20 | FromDiscord | <Conifer> yeah... Was never fan of their enums.↵Are there any good VSC plugins I should look into? Seen few really outdated, the only one I found so far is by nimsaem |
15:41:29 | Zoom[m] | Is this a topic worthy enough for the forum, perhaps? |
15:41:39 | leorize[m] | nimsaem is the best vsc plugin atm |
15:41:55 | FromDiscord | <Conifer> take it nothing else needed apart from it? |
15:42:02 | leorize[m] | Zoom: can you post the benchmark again? I believe I haven't seen it |
15:42:08 | Zoom[m] | https://github.com/ZoomRmc/countwords_nim |
15:42:11 | leorize[m] | @Confier pretty much |
15:42:23 | FromDiscord | <Conifer> 👍 |
15:42:35 | Zoom[m] | Here's my version, it's about 3-4% faster than the optimized one from the original repo. |
15:43:32 | leorize[m] | Zoom: drop the custom buffering and use lexbase |
15:43:51 | leorize[m] | I did that and nearly beat the optimized C :p |
15:45:03 | Zoom[m] | I understand the algo has a lot of points of attack to optimize further, but at this stage it's almost the equivalent to Go code, yet it's seriously lags behind |
15:46:10 | Zoom[m] | BTW, What are the options to profile the Nim code besides cachegrind? |
15:46:42 | leorize[m] | you can use intel vtune |
15:47:42 | FromDiscord | <Rika> zoom: the nim one runs faster for me |
15:48:00 | FromDiscord | <zetashift> In reply to @leorize "<@77574388035100672> I'll push an": I've been trying out neovim for a few days and I gotta say with the Lua stuff, I really like it. It has gotten really far since I tried it 2 years ago, where every little thing broke on me cause I'm dumb. |
15:48:14 | FromDiscord | <zetashift> I am thinking of trying to take a crack at writing a treesitter grammar |
15:48:20 | Zoom[m] | @Rika, huh, the one from my repo? |
15:48:37 | FromDiscord | <Rika> yes |
15:48:43 | Zoom[m] | How did you measure? |
15:48:55 | FromDiscord | <Rika> https://media.discordapp.net/attachments/371759389889003532/827570298081509466/unknown.png |
15:48:56 | FromDiscord | <Rika> hyperfine |
15:49:01 | Zoom[m] | Did you ensure the file was hot in the cache? |
15:49:40 | leorize[m] | @zetashift saem, Prestige and I currently have the idea of porting the compiler's lexer to tree-sitter |
15:49:55 | leorize[m] | I believe none of us has done a thing torwards that though :P |
15:49:59 | FromDiscord | <Rika> ive no clue what you mean, your script doesnt seem to do that either? |
15:50:05 | leorize[m] | Zoom: hyperfine does that automatically |
15:50:32 | Zoom[m] | Yeah, I see. Typed before seeing the answers |
15:50:55 | FromDiscord | <zetashift> In reply to @leorize "<@77574388035100672> saem, Prestige and": I mean, I just wanted to look at python/js treesitter grammars and just try to hack my way through, using the lexer sounds fancy af |
15:51:22 | leorize[m] | it's kinda hard to grammar your way through with nim's style insensitivity :P |
15:51:50 | Prestige | Yeah for sure |
15:52:09 | FromGitter | <bung87> that sounds like rewrite the compiler |
15:52:21 | FromDiscord | <Rika> that sounds like glhf |
15:52:21 | leorize[m] | if you want to use regex, feel free to study nim.nvim syntax regexes, which I'm proud to say is the most accurate right now regarding numbers, pragmas, etc :) |
15:52:43 | FromDiscord | <zetashift> In reply to @leorize "it's kinda hard to": Ah, I might not have thought this through all the way hahahah |
15:52:44 | leorize[m] | there's no need to rewrite the compiler, the lexer is pretty pluggable |
15:53:04 | Zoom[m] | Rika, could you please measure with the bible_x50 on your HW? |
15:53:20 | FromDiscord | <Rika> on my ram? |
15:53:54 | Zoom[m] | I mean of course you will measure on your hardware, not mine :) |
15:54:06 | FromDiscord | <Rika> no difference |
15:54:28 | leorize[m] | @zetashift I've seen your post on the forum, looks like nim-compe is the now preferred completion provider? |
15:54:29 | FromDiscord | <Rika> no statistically significant difference, i sent an image above if you missed it |
15:55:09 | leorize[m] | how is it compared to asyncomplete? I'm thinking of providing native support for all popular completion plugins instead of expecting people to work their way through |
15:56:31 | FromDiscord | <zetashift> erhm, compe with nimlsp, just worked for me. I use Scala, Elixir and JS too and with those it was all so no hassle to set up |
15:56:41 | FromDiscord | <Rika> zoom: did you see the image? |
15:56:45 | Zoom[m] | Ok. I was interested if there could be any reallocation shenanigans going one for a bigger input which could affect results. |
15:57:10 | FromDiscord | <zetashift> also AFAIK windows works too, which with the suggested async of nim.nvim didn't work well (I gave up on that like 2 years ago) |
15:57:19 | leorize[m] | the nim version is slightly slower for me, I'll look in a bit |
15:57:29 | FromDiscord | <Rika> okay |
15:57:32 | FromDiscord | <Rika> wait |
15:57:34 | Zoom[m] | @Rika, yep seen it. Nim version? CPU? |
15:57:48 | FromDiscord | <Rika> ill show the x50 too just so you can see that too |
15:57:55 | FromDiscord | <Rika> im on almost-latest devel |
15:57:58 | FromDiscord | <Rika> 2700x |
15:57:59 | FromDiscord | <zetashift> You want me to sent me my compe config so it can be added to the README? |
15:58:07 | Zoom[m] | Thanks, Rika |
15:58:18 | FromDiscord | <Rika> the larger file makes nim slower |
15:58:46 | FromDiscord | <Rika> BUT go's max is roughly == nim's max |
15:59:10 | FromDiscord | <Rika> ah, misread the max |
15:59:11 | FromDiscord | <Rika> lmao |
15:59:13 | FromDiscord | <Rika> https://media.discordapp.net/attachments/371759389889003532/827572887476633670/unknown.png |
15:59:29 | FromDiscord | <Rika> ill uprof this |
15:59:43 | * | gangstacat quit (Ping timeout: 250 seconds) |
16:00:19 | Zoom[m] | That's more like my results. Go is currently at 88% of Nim for me |
16:00:32 | * | Zoom[m] uploaded an image: (13KiB) < https://matrix.org/_matrix/media/r0/download/matrix.org/GsvswKQnYfoxzHbaTVrwIsqK/countwords_nim_cachegrind.png > |
16:00:47 | Zoom[m] | Don't know if you can see the attachments via matrix bridge |
16:01:08 | FromDiscord | <Rika> n |
16:01:10 | FromDiscord | <Rika> can |
16:01:50 | leorize[m] | @zetashift don't worry, I already created one :P I'm experimenting with some changes to the completion so it will go up with that |
16:02:01 | FromDiscord | <Rika> i bet this is because of many string copies |
16:04:11 | Zoom[m] | I suppose so. But where are they happening? During sort? We explicitly copy only on insertion and output. |
16:04:58 | * | vicfred joined #nim |
16:05:38 | FromDiscord | <Rika> string[int..int] |
16:06:04 | FromDiscord | <Rika> any copy is bad because i think go does barely any |
16:06:43 | * | leorize[m] < https://matrix.org/_matrix/media/r0/download/matrix.org/hsYISnAGlQXZvZotDTUAzNIM/message.txt > |
16:07:35 | leorize[m] | though that copy for words.inc is necessary |
16:07:49 | leorize[m] | to combat that, creates a buffer specifically for it |
16:08:08 | leorize[m] | so that you never have a "buffer-create/buffer-delete" cycle every loop |
16:08:15 | leorize[m] | that's my trick to beat the C version |
16:10:18 | Zoom[m] | @Rika there's only one slicing happening in my code |
16:11:31 | FromDiscord | <lantos> hmmm, trying to make an audio queue but the deque object keeps crashing at 64 length |
16:12:01 | FromDiscord | <lantos> (edit) "hmmm, trying to make an audio queue but the deque object keeps crashing at 64 length" => "sent a code paste, see https://play.nim-lang.org/#ix=2UPz" |
16:12:11 | FromDiscord | <lantos> (edit) "https://play.nim-lang.org/#ix=2UPz" => "https://play.nim-lang.org/#ix=2UPA" |
16:17:58 | * | gangstacat joined #nim |
16:18:38 | Zoom[m] | leorize: looks cool but I don't get how can I use a special buffer for inserting. I'm just passing a slice directly into `inc` |
16:19:00 | leorize[m] | that "slice" is copied |
16:19:34 | leorize[m] | and for that to happen, a temporary buffer is created to store the copy, which involves memory allocation then deallocation after the loop |
16:20:09 | leorize[m] | by using one long-lived buffer for this, you avoid that slow cycle |
16:20:50 | FromDiscord | <Rika> zoom: your hash function takes the most time accdg to uprof |
16:20:53 | FromDiscord | <lantos> is that @me leorize or something else? |
16:20:58 | Zoom[m] | Of course, but isn't the copy happening inside `insertImpl()` regardless? |
16:21:33 | Zoom[m] | @Rika it's just a copy from std to bypass murmur |
16:21:51 | leorize[m] | Zoom: yes but have you counted when insert is not happening? |
16:21:54 | FromDiscord | <Rika> idt thats how that works but okay |
16:22:59 | FromDiscord | <Rika> your code is wrong as well, i get an assertiondefect when running out of danger |
16:24:51 | Zoom[m] | Try removing that hash proc, it's slower on my machine. |
16:25:57 | leorize[m] | the default hashing algo is not meant to be very fast, but to avoid duplicate hashes |
16:26:28 | Zoom[m] | That's why I tried to bypass it. |
16:28:20 | FromDiscord | <Rika> here be possible hotspots? https://media.discordapp.net/attachments/371759389889003532/827580214598172712/unknown.png |
16:30:09 | FromDiscord | <Rika> so yeah i think str copies are still fucking the program |
16:30:18 | FromDiscord | <Rika> i still think |
16:30:34 | Zoom[m] | @Rika It very well might be wrong, but the output is equal to Go code on the test file (except the order) |
16:32:29 | * | Gustavo6046 quit (Quit: ZNC 1.8.2 - https://znc.in) |
16:32:31 | FromGitter | <UrKr> can I use deep copy from js nim? |
16:33:00 | FromGitter | <UrKr> I'm getting undeclared identified deepCopy |
16:33:06 | * | Gustavo6046 joined #nim |
16:33:08 | FromDiscord | <Rika> https://media.discordapp.net/attachments/371759389889003532/827581425754570812/unknown.png |
16:33:09 | FromGitter | <UrKr> nim 1.4.4 |
16:33:18 | FromDiscord | <Rika> some more interestingly high points |
16:33:35 | FromDiscord | <Rika> esp. that 5 one, but thats a while loop so likely expected |
16:33:42 | Zoom[m] | leorize: sorry, I'm too dumb, still don't understand how we can avoid copying for inc without modifying how tables work. |
16:33:54 | FromDiscord | <Rika> seems inefficient though |
16:35:26 | leorize[m] | Zoom: http://ix.io/2UPE |
16:35:30 | leorize[m] | it's faster than go now |
16:35:40 | leorize[m] | probably can be even faster once I clean up more of your code |
16:39:39 | leorize[m] | Zoom: note that we are not avoiding all copies, we are avoiding one extra |
16:40:55 | FromDiscord | <Rika> thats what i said T_T even if we do just one copy, thats already pretty significant over go |
16:41:27 | Zoom[m] | Yep, checked it. Cool trick |
16:42:35 | leorize[m] | once views mature we would stop having to do this kind of thing :P |
16:45:35 | FromDiscord | <exelotl> vieeeeeews!!!! |
16:50:11 | Zoom[m] | Wait, do we have automatic enumeration in `for` loops? |
16:50:33 | leorize[m] | we do, std/enumerate |
16:50:58 | leorize[m] | some types provide a pairs() iterator that does pretty much the same thing |
16:51:19 | Zoom[m] | Didn't know it works implicitly like in your code |
16:51:41 | leorize[m] | it's the pairs iterator, not enumerate |
16:53:41 | Zoom[m] | I get that :) |
16:55:58 | Zoom[m] | Anyway, I think I'm just starting to understand what's happening there and I would expect inc(slice) to do it like that. |
17:18:22 | * | hoijui joined #nim |
17:39:43 | * | hoijui quit (Ping timeout: 246 seconds) |
17:40:02 | * | hoijui joined #nim |
17:44:40 | haxscramper | I'm getting ambiguous call error for a **SINGLE** procedure, with declaration positions showing absolutely identical locations: `htree_distance.[](node: NodeId[[].L, [].V], idx: int)` [declared in `htree_distance.nim(413, 6)`] and `htree_distance.[](node: NodeId[[].L, [].V], idx: int)` [declared in `htree_distance.nim(413, 6)`]. |
17:44:40 | haxscramper | |
17:44:43 | haxscramper | (full declaration path omitted because it is not necessary). It happens when I run unit tests in github CI - I cannot reproduce it locally, even when trying it out with completely new docker instance. |
17:44:43 | haxscramper | |
17:44:58 | haxscramper | https://github.com/haxscramper/hmisc/runs/2255489324?check_suite_focus=true#step:5:195 link to the error itself |
17:46:03 | haxscramper | I'm not even sure what cause this, because I haven't touched the code, or any of it's direct dependencies for couple month at this poing |
17:46:28 | haxscramper | I'm using setup-nim for CI and just run `nimble test` as a test job |
17:48:06 | haxscramper | Anyone got ideas? |
17:49:51 | * | fputs quit (Ping timeout: 246 seconds) |
17:52:09 | * | fputs joined #nim |
17:56:08 | haxscramper | Can't even reproduce on completely new nim installation with all dependencies newly installed. And of course it doesn't break when just compiling locally |
18:05:16 | FromDiscord | <zetashift> @leorize I'm guessing syntax highlighting breaking halfway through a file is nim.nvim <-> nimsuggest related? |
18:05:54 | leorize[m] | no, you're dealing with long strings, right? |
18:06:58 | FromDiscord | <zetashift> Just reading through: https://github.com/nim-lang/nimforum/blob/master/src/frontend/threadlist.nim and editing it |
18:08:02 | leorize[m] | do you have a pic showing that? |
18:08:32 | leorize[m] | oh it's nim js stuff... |
18:08:40 | leorize[m] | nimsuggest is not a big fan of those |
18:09:45 | leorize[m] | yea i think your issue is nimsuggest related |
18:09:49 | saem | 👋 |
18:13:48 | * | sagax joined #nim |
18:14:44 | FromDiscord | <zetashift> ah good to know, at first I actually didn't even notice haha https://media.discordapp.net/attachments/371759389889003532/827606992927195147/unknown.png |
18:18:38 | * | tane joined #nim |
18:20:19 | FromDiscord | <checkersai> Is there a way to generate Nim AST at runtime? I want to write a language that transpiles to Nim, sorta like what ReasonML is to OCaml |
18:20:43 | FromDiscord | <Yardanico> you can use the compiler as a library |
18:20:49 | leorize[m] | yes, you can use the compiler's ast library |
18:20:56 | FromDiscord | <Yardanico> but of course the API is lower-level than std's macros |
18:21:17 | FromDiscord | <checkersai> Cool |
18:21:57 | FromDiscord | <checkersai> And since I can use the compiler as a library I also have access to the semantic checker and c code generator, right? |
18:22:31 | FromDiscord | <haxscramper> yes, though using semcheck is not well documented |
18:23:03 | FromDiscord | <haxscramper> https://github.com/haxscramper/haxdoc/blob/master/src/haxdoc/compiler_aux.nim#L48 that is the basic setup you need to use in order to semcheck AST |
18:23:44 | FromDiscord | <haxscramper> And for using C code generator you would probably need to read how it is used in the compiler itself, I haven't touched this part yet |
18:23:57 | leorize[m] | you can look at nimterop as an example of generating code with the compiler's ast library |
18:24:13 | leorize[m] | for generating code I'd recommend shooting it to nim instead |
18:25:15 | FromDiscord | <haxscramper> I also made https://haxscramper.github.io/hnimast/src/hnimast.html to make code generation easier, so you can do things like `newPProcDecl("hello", exported = true)` |
18:25:27 | FromDiscord | <haxscramper> I use it for hcparse code generation |
18:25:49 | FromDiscord | <zetashift> In reply to @checkersai "Is there a way": Nim as a target, $LANG -> Nim -> JS/C/C++ -> machine code, how far can we go? |
18:26:02 | FromDiscord | <checkersai> Thanks |
18:26:15 | FromDiscord | <haxscramper> It can also unparse existing code into higher-level objects like https://haxscramper.github.io/hnimast/src/hnimast/object_decl.html#ObjectDecl if you need this |
18:26:33 | FromDiscord | <checkersai> In reply to @zetashift "Nim as a target,": I'm not really trying to make a new language, just a syntax skin over nim |
18:27:39 | FromDiscord | <JSONBash> is there a bcrypt library that anyone recommends using? |
18:30:40 | FromDiscord | <JSONBash> the one I found is a wrapper on C but hasnt been updated in a while, when i think bcrypt has |
18:31:56 | FromDiscord | <haxscramper> Nim wrappers don't require updating for newer versions of the library unless new procedures/types are introduced. And you can always write your own wrapper additions without even patching the original library |
18:32:37 | FromDiscord | <haxscramper> `importcpp: ".missingField"` |
18:32:48 | FromDiscord | <JSONBash> i just meant that the C files have not been updated in 3 years |
18:33:02 | FromDiscord | <JSONBash> which isnt a bad thing |
18:33:17 | FromDiscord | <JSONBash> just for security libraries it seems unusual |
18:34:13 | FromDiscord | <haxscramper> I didn't know it uses `.compile:` in main library. Then yes, I think it can't be fixed without updating. |
18:34:49 | * | natrys joined #nim |
18:35:20 | FromDiscord | <zetashift> Didn't nim have syntax skins? |
18:37:20 | FromDiscord | <haxscramper> They were not really supported and deprecated |
18:37:32 | FromDiscord | <haxscramper> And finally removed before 1.0 I think |
18:38:25 | FromDiscord | <haxscramper> But I, too, would prefer 4-space indent with curly braces, and it won't be that difficult to write standalone frontend for nim compiler |
18:42:47 | liblq-dev | heresy |
18:43:26 | haxscramper | After seveal years on nim I starting to think more and more often that I would prefer curly braces over indentation |
18:44:33 | haxscramper | And at this point I'm writing nim almost all the time, and not so much other languages. |
18:46:07 | Prestige | That's one of my biggest gripes about it, I fuck up indentation all the time |
18:46:28 | FromDiscord | <zetashift> Scala actually is transitioning from braces to indentation |
18:47:10 | haxscramper | Yes, same here. Indentation-based paired with use-only-two-spaces is just a bit too unreadable at times. |
18:48:34 | FromDiscord | <checkersai> That's basically what I'm trying to do lol |
18:48:52 | FromDiscord | <checkersai> I wanted to write a brace-based skin over nim |
18:49:28 | Prestige | If you get something decent working let us know.. |
18:49:40 | FromDiscord | <XxDiCaprioxX> quick question: is there a way to divide which returns an int (like in python `int1 // int2`) |
18:49:54 | FromDiscord | <haxscramper> @checkersai if you want to look for examples on writing lexer/parser in nim you can check out: https://gist.github.com/haxscramper/3562fa8fee4726d7a30a013a37977df6#writing-own-parser |
18:50:03 | FromDiscord | <zetashift> In reply to @XxDiCaprioxX "quick question: is there": `div` |
18:50:11 | FromDiscord | <checkersai> Thanks |
18:50:26 | FromDiscord | <haxscramper> And links at the bottom for examples of the parser for languages implemented in nim. |
18:50:32 | FromDiscord | <XxDiCaprioxX> thanks |
18:50:55 | FromDiscord | <zetashift> There is a repl bot here but I don't know how to call it to show an example sorry lol |
18:55:19 | FromDiscord | <zetashift> I find really nested blocks to be the only real buzzkill for me with Nim & Python |
18:57:04 | FromDiscord | <haxscramper> Using braced skip would also allow to use some existing pretty printer. clang-format is actually good enough to not break even unsupported languages |
18:58:57 | FromDiscord | <zetashift> pretty printer? Like a formatter or? |
18:59:20 | FromDiscord | <haxscramper> yes, code formatter |
19:00:22 | FromDiscord | <zetashift> ah yea |
19:01:03 | FromDiscord | <XxDiCaprioxX> 'nother quick question - is there an easy way of measuring elapsed time for efficiency purposes? |
19:01:56 | * | al1ranger joined #nim |
19:02:45 | FromDiscord | <haxscramper> https://github.com/treeform/benchy for microbenchmarking use this, or I guess `getCpuTime()` |
19:06:16 | FromDiscord | <checkersai> In reply to @zetashift "I find really nested": I don't like python for many reasons but yeah for Nim it's one of my only complaints |
19:06:37 | FromDiscord | <checkersai> And frankly it's kind of a minor complaint which is a testament to how great everything else is about Nim |
19:07:12 | FromDiscord | <XxDiCaprioxX> In reply to @haxscramper "https://github.com/treeform/benchy for microbenchma": thank you! do I put into `keep()` what WOULD be the result of my program or do I just call it at the end of the block? |
19:08:06 | FromDiscord | <XxDiCaprioxX> nevermind |
19:11:12 | FromDiscord | <XxDiCaprioxX> now this is probably a super dumb question but does: `-d:release` have any requirements normal compilation doesn't have? |
19:12:17 | leorize[m] | it just enables optimization and disable some very heavy debugging features |
19:13:42 | FromDiscord | <zetashift> In reply to @checkersai "And frankly it's kind": In practice I haven't seen it as a major roadblack, and I have yet to see a language that's as readable as Nim |
19:16:27 | FromDiscord | <XxDiCaprioxX> In reply to @leorize "it just enables optimization": Then it must be a different reason my compilation fails |
19:17:42 | leorize[m] | note that code can detect when it's being compiled with `-d:release` via `when defined(release)`, so your code might be taking a different branch |
19:18:49 | leorize[m] | @haxscramper no one really stops you from moving to 4-space indentation y'know :P |
19:20:00 | FromDiscord | <XxDiCaprioxX> In reply to @leorize "note that code can": nope, normal compilation also failed. thanks for the tip tho |
19:22:20 | haxscramper | leorize[m]: technically yes, but this doesn't bother me enough to manually switch over. When I will finally get time to write *working* pretty-printer I should add option to indent on four spaces |
19:22:32 | haxscramper | And reformat all my code with it |
19:23:38 | FromDiscord | <checkersai> hmm I'm thinking instead of writing a compiler from scratch, I can just fork the nim parser and make changes to it |
19:24:23 | * | al1ranger quit (Quit: Leaving) |
19:27:00 | FromDiscord | <haxscramper> I'm not sure how this partic in particular is implemented, but my guess is that you can just adapt code from https://github.com/nim-lang/Nim/blob/9abd383a2ae36e50ee23b78654e9d8154db46c84/compiler/main.nim#L90 |
19:28:07 | shmorgle | I have ssh2-0.1.0 from the nimble directory |
19:28:08 | FromDiscord | <haxscramper> You can try using https://github.com/haxscramper/haxdoc - it provides sourcetrail integration, so you can quickly dive into compiler implementation and check how things are implemented and used |
19:28:56 | shmorgle | was trying to modify the simple ssh code given as an example, into something where I could say, read in a list of IPs |
19:29:07 | shmorgle | and connect to say 20 ssh hosts in parallel |
19:30:24 | shmorgle | does anyone have a sample bit of code that shows how to loop over a list of IPs and do the async / await on that? |
19:36:36 | * | hoijui quit (Ping timeout: 246 seconds) |
19:38:04 | FromDiscord | <haxscramper> In reply to @checkersai "hmm I'm thinking instead": https://github.com/nim-lang/Nim/blob/9abd383a2ae36e50ee23b78654e9d8154db46c84/compiler/passes.nim#L139 I think you just need to start here, and reimplement `parseTopLevelStmt` and other necessary parts |
19:41:28 | FromDiscord | <checkersai> thanks again! |
19:42:07 | FromDiscord | <Recruit_main707> libertarian? 👀 |
19:43:18 | FromDiscord | <checkersai> kekistani? |
19:44:05 | FromDiscord | <Recruit_main707> i see, you're a man of culture as well |
19:44:50 | FromDiscord | <checkersai> indubitably |
20:05:45 | * | narimiran joined #nim |
20:42:35 | * | Gustavo6046 quit (Quit: ZNC 1.8.2 - https://znc.in) |
20:42:59 | * | Gustavo6046 joined #nim |
20:50:11 | * | narimiran quit (Ping timeout: 240 seconds) |
20:57:54 | FromDiscord | <brainproxy> sent a code paste, see https://play.nim-lang.org/#ix=2UQD |
20:59:32 | FromDiscord | <brainproxy> nvm, this seems to have relevant info/answer: https://github.com/nim-lang/Nim/issues/15220 |
21:05:23 | FromDiscord | <Tuatarian> Is there a way to take non-blocking keyboard input in the background? |
21:12:03 | FromDiscord | <Tuatarian> and send keyboard input from the bg as well |
21:12:23 | * | haxscramper quit (Remote host closed the connection) |
21:25:08 | FromDiscord | <checkersai> Where is `IdGenerator` defined? |
21:25:18 | FromDiscord | <demotomohiro> There are windows api that can do that but i forget api name |
21:25:25 | FromDiscord | <checkersai> (edit) "defined?" => "defined in the compiler?" |
21:28:59 | FromDiscord | <checkersai> nvm I got it |
21:33:04 | * | natrys quit (Quit: natrys) |
21:38:19 | * | Vladar quit (Quit: Leaving) |
21:56:00 | ForumUpdaterBot | New thread by Tsojtsoj: Performance issue with closure, see https://forum.nim-lang.org/t/7738 |
22:03:10 | * | wasted_youth2 quit (Ping timeout: 258 seconds) |
22:03:59 | * | wasted_youth2 joined #nim |
22:18:44 | ForumUpdaterBot | New question by Alex Craft: How to normalise file path in Nim?, see https://stackoverflow.com/questions/66925906/how-to-normalise-file-path-in-nim |
22:43:59 | * | lritter quit (Quit: Leaving) |
22:47:17 | * | NimBot joined #nim |
22:47:41 | * | tane quit (Quit: Leaving) |
22:53:21 | FromDiscord | <Yardanico> nice spam, https://media.discordapp.net/attachments/371759389889003532/827677110159933450/unknown.png |
22:58:06 | ForumUpdaterBot | New thread by Japplegame: Static tuple generic parameter, see https://forum.nim-lang.org/t/7740 |