00:00:57 | * | flouer joined #nim |
00:01:44 | * | flouer_ quit (Remote host closed the connection) |
00:10:56 | * | khazakar quit (Quit: Connection closed for inactivity) |
00:12:42 | FromDiscord | <luteva> if it really is threadsafe, use '{.gcsafe.}' otherwise use "--threads:off" if you would like to use only one thread. ๐ |
00:18:19 | FromDiscord | <Robyn [She/Her]> In reply to @isofruit "Note: This gets a": Wish we didn't have to do `{.gcsafe.}` tbh |
00:24:29 | NimEventer | New thread by emg: #pragma pack(push, n) equivalent for Nim Objects, see https://forum.nim-lang.org/t/10845 |
00:26:42 | * | khazakar joined #nim |
00:27:38 | FromDiscord | <Elegantbeef> You have to `{.cast(gcSafe).}:` around it, the compiler is not overly smart |
00:41:51 | * | jmdaemon joined #nim |
01:08:06 | FromDiscord | <Robyn [She/Her]> Is there a way to declare globals as gcsafe, somehow? :p |
01:08:10 | FromDiscord | <Robyn [She/Her]> Certain globals |
01:08:41 | FromDiscord | <Elegantbeef> Nope |
01:15:46 | FromDiscord | <Robyn [She/Her]> Damn |
01:16:32 | FromDiscord | <Robyn [She/Her]> I wonder if it's possible to overload `.` in a way that most field/method access code is unaffected unless there's a specific pragma on a variable |
01:16:35 | FromDiscord | <Robyn [She/Her]> It's probably possible |
01:16:47 | FromDiscord | <Robyn [She/Her]> In reply to @chronos.vitaqua "I wonder if it's": I'd imagine this would be a macro or template |
01:17:16 | FromDiscord | <Robyn [She/Her]> Probably macro because you need to check if a symbol has a pragma attached, right? |
01:19:14 | FromDiscord | <Elegantbeef> there is the experimental dot operators |
01:19:17 | FromDiscord | <Elegantbeef> you could use a concept |
01:19:24 | FromDiscord | <Elegantbeef> But remember they only are used if everything falls through |
01:24:19 | FromDiscord | <Robyn [She/Her]> How would I use a concept for this, exactly? |
01:24:31 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "But remember they only": Fair |
01:27:45 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/UmFlv |
01:28:00 | FromDiscord | <Robyn [She/Her]> Not sure about how I'd specifically implement the thing but I have an idea for it, thanks! Definitely interesting- |
01:41:18 | FromDiscord | <charlie_charlie6557> sent a long message, see <!doctype html> |
01:41:25 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
01:41:26 | FromDiscord | <charlie_charlie6557> (edit) |
01:41:26 | FromDiscord | <Phil> (edit) |
01:42:07 | FromDiscord | <scipio_nl> In reply to @chronos.vitaqua "Not sure about how": "_ I don't know what it means but it sounds provocative_" |
01:45:26 | FromDiscord | <Robyn [She/Her]> In reply to @scipio_nl ""_ I don't know": No I understand what's happening, I suggested using a pragma or something to indicate a variable is gcsafe, then you'd have to implement a dot operator overload so you can check if a var is declared as gcsafe and stuff |
01:48:57 | FromDiscord | <scipio_nl> In reply to @chronos.vitaqua "No I understand what's": I understood you understand. |
01:53:39 | FromDiscord | <Robyn [She/Her]> Oh |
01:53:55 | FromDiscord | <Robyn [She/Her]> I didn't understand that message you sent then :p |
01:53:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
01:54:26 | FromDiscord | <Elegantbeef> `field: untyped` |
01:54:29 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=html> |
01:54:43 | FromDiscord | <Robyn [She/Her]> Also that's actually pretty nice- |
01:55:04 | FromDiscord | <scipio_nl> In reply to @chronos.vitaqua "I didn't understand that": It's a meme ๐ |
01:55:23 | FromDiscord | <Elegantbeef> There we go seeya is now a nimble package that libnimib now depends on, I'm making silliness somewhat consumable |
01:55:47 | FromDiscord | <albassort> i would like a mutable object |
01:55:52 | FromDiscord | <albassort> that i can copy |
01:56:01 | FromDiscord | <albassort> ref objects copy as refs |
01:56:10 | FromDiscord | <albassort> i just wanna preserve the state |
01:56:54 | FromDiscord | <Elegantbeef> https://github.com/beef331/libnimib/blob/master/include/nimib.h What a nicely generate header file |
02:00:49 | FromDiscord | <albassort> actually |
02:00:55 | FromDiscord | <albassort> no i want to copy a ref object |
02:01:32 | FromDiscord | <Elegantbeef> You used to be able to do `deepCopy` but that's now behind a flag |
02:01:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
02:02:41 | FromDiscord | <albassort> yeah but thats nasty |
02:02:54 | FromDiscord | <albassort> In reply to @Elegantbeef "You used to be": why is deepcopy now banned |
02:02:56 | FromDiscord | <spacelucy> sent a code paste, see https://play.nim-lang.org/#ix=html> |
02:03:35 | FromDiscord | <Elegantbeef> `parseJson` does not take in a `Future[string]` |
02:03:42 | FromDiscord | <Elegantbeef> your await needs to be inside `parseJson` not outside it |
02:03:56 | FromDiscord | <spacelucy> oh I see |
02:03:59 | FromDiscord | <albassort> specifically the part of the stack |
02:04:03 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=html> |
02:04:06 | FromDiscord | <albassort> you're looking for that |
02:04:22 | FromDiscord | <Elegantbeef> Well also `Future[system.string]` |
02:04:40 | FromDiscord | <Elegantbeef> Real shame that Araq did not like my idea of storing all macros pre-expansion |
02:04:44 | FromDiscord | <albassort> (edit) |
02:04:47 | FromDiscord | <Elegantbeef> Made error messages much more readable |
02:05:14 | FromDiscord | <albassort> yeah but you also don't get to see whats actually happening to your code |
02:05:25 | FromDiscord | <Elegantbeef> Only in error messages |
02:05:31 | FromDiscord | <Elegantbeef> `expandMacros` and the like would still work |
02:05:40 | FromDiscord | <albassort> i've never heard of expandMacros |
02:05:48 | FromDiscord | <albassort> i have heard and seen deepcopy tho |
02:05:50 | FromDiscord | <albassort> what happened with that |
02:06:04 | FromDiscord | <Elegantbeef> It's a macro in `std/macros` and a flag of `--expandMacro:...` |
02:06:08 | FromDiscord | <Elegantbeef> No clue deep copy is ugly |
02:06:10 | FromDiscord | <Robyn [She/Her]> In reply to @scipio_nl "It's a meme ๐": Ooh |
02:06:31 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=html> |
02:06:34 | FromDiscord | <albassort> this is uglier |
02:06:51 | FromDiscord | <Elegantbeef> Imagine of Nim had procs |
02:07:03 | FromDiscord | <albassort> >:( |
02:07:06 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "Real shame that Araq": Why was that denied? Redundancy? |
02:07:23 | FromDiscord | <spacelucy> why? |
02:07:27 | FromDiscord | <Robyn [She/Her]> I feel like not focusing on improving Nim's error messages is kinda counterintuitive to making people more willing to use Nim |
02:07:28 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
02:07:34 | FromDiscord | <albassort> In reply to @spacelucy "why?": because thats the actual type error |
02:07:45 | FromDiscord | <albassort> the type error is that its not getting a Future[string] |
02:07:53 | FromDiscord | <spacelucy> whats the difference between string and system.string |
02:08:00 | FromDiscord | <Robyn [She/Her]> They're the same thing |
02:08:02 | FromDiscord | <albassort> none its just specific to where it came from |
02:08:07 | FromDiscord | <Robyn [She/Her]> system is just the module string comes from |
02:08:09 | FromDiscord | <albassort> system is the pacakge |
02:08:13 | FromDiscord | <albassort> (edit) "pacakge" => "module" |
02:08:15 | FromDiscord | <spacelucy> OH |
02:08:17 | FromDiscord | <spacelucy> misread |
02:08:18 | FromDiscord | <spacelucy> sorry |
02:08:20 | FromDiscord | <spacelucy> yeah |
02:08:20 | FromDiscord | <Robyn [She/Her]> And system is the built-in module |
02:08:25 | FromDiscord | <Robyn [She/Her]> You're good, no worries! |
02:08:50 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/pull/20183 robyn |
02:09:42 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
02:10:32 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
02:10:36 | FromDiscord | <Elegantbeef> Atleast better than that |
02:10:42 | * | xet7 joined #nim |
02:12:30 | FromDiscord | <girvo> In reply to @luteva "if it really is": It's multi-threaded embedded code ๐ฅฒ |
02:12:37 | FromDiscord | <albassort> In reply to @girvo "It's multi-threaded embedded code": hot |
02:12:53 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=html> |
02:13:03 | FromDiscord | <albassort> i mean |
02:13:10 | FromDiscord | <Robyn [She/Her]> In reply to @girvo "It's multi-threaded embedded code": Did you see the neat thing beef came up with? :p |
02:13:12 | FromDiscord | <albassort> my brain has pathways developed just to read nim errors |
02:13:20 | FromDiscord | <albassort> so idrc |
02:13:23 | FromDiscord | <Robyn [She/Her]> Async code is a pain bc of the errors :p |
02:13:38 | FromDiscord | <Robyn [She/Her]> In reply to @albassort "my brain has pathways": I'm also semi-used to it, tbf, but it'd be a nice improvement either way |
02:13:59 | FromDiscord | <albassort> it was a bit tongue in cheek |
02:13:59 | FromDiscord | <Elegantbeef> Right you have to learn to understand Nim errors, but there is no reason to have to sift through a macro expansion when the error is you added `discard` |
02:14:47 | FromDiscord | <Robyn [She/Her]> Yeah, exactly |
02:15:20 | FromDiscord | <Robyn [She/Her]> Why could that make the compiler more difficult to expand upon? Hm |
02:15:32 | FromDiscord | <Robyn [She/Her]> Assuming Araq hasn't changed his opinions on this either? |
02:15:41 | FromDiscord | <Elegantbeef> Don't ask me I hardly ever argue with Araq cause it's a fool's errand |
02:15:58 | FromDiscord | <Robyn [She/Her]> Fair |
02:16:12 | FromDiscord | <albassort> Araq is a man who makes up his mind |
02:16:16 | FromDiscord | <albassort> and then thats really it |
02:16:22 | FromDiscord | <girvo> In reply to @chronos.vitaqua "Did you see the": not yet, lemme scroll |
02:16:25 | FromDiscord | <albassort> until they stumble upon it themselves |
02:17:03 | FromDiscord | <girvo> sent a code paste, see https://play.nim-lang.org/#ix=html> |
02:17:44 | FromDiscord | <Robyn [She/Her]> Yeah! |
02:17:52 | FromDiscord | <Elegantbeef> It also still works with locks! ๐ |
02:17:58 | FromDiscord | <Robyn [She/Her]> In reply to @albassort "until they stumble upon": Yeaaah- I'm here for the language tbf, sooo- |
02:19:44 | FromDiscord | <Elegantbeef> The non expanded macro change is relatively small so on the plus side it's likely not too hard to apply it as a patch ๐ |
02:19:45 | FromDiscord | <Elegantbeef> Code rendering does not change much |
02:20:27 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "The non expanded macro": It is, yeah, soooo I could do that hmmm |
02:20:44 | FromDiscord | <Robyn [She/Her]> I wonder if the code you've edited has changed upstream |
02:24:02 | FromDiscord | <Elegantbeef> One git merge away |
02:24:53 | FromDiscord | <nikhilsimha> Hello nim experts - I have been trying to get nim to top the charts in plb2 (programming language benchmarks). I ran into a weird compiler flag behavior. https://github.com/attractivechaos/plb2/pull/27. |
02:26:03 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "One git merge away": https://patch-diff.githubusercontent.com/raw/nim-lang/Nim/pull/20183.patch oooor a patch file :) |
02:26:53 | FromDiscord | <Elegantbeef> Correct my ignorance isn't a patch file just a funnily named merge? |
02:27:08 | FromDiscord | <Elegantbeef> Nikhil I responded in the post if I understand your confusion properly ๐ |
02:27:11 | FromDiscord | <Robyn [She/Her]> Aren't merged based on patch files? :p |
02:27:35 | FromDiscord | <Robyn [She/Her]> Merges |
02:27:41 | FromDiscord | <Elegantbeef> Do I look like someone that knows git vernacular |
02:27:58 | FromDiscord | <Robyn [She/Her]> Nope |
02:28:34 | FromDiscord | <leorize> a patch file here is just a text version of a commit |
02:28:38 | FromDiscord | <nikhilsimha> In reply to @Elegantbeef "Nikhil I responded in": Thanks ๐ ! I am confused about why -d danger works to speed up the code but the current -d release actually slows down the code. : https://github.com/attractivechaos/plb2/pull/27#issuecomment-1876201746 |
02:28:49 | FromDiscord | <Elegantbeef> cause `-d:release` has checks on still |
02:28:53 | FromDiscord | <Elegantbeef> `-d:danger` turns all checks off |
02:28:55 | FromDiscord | <graveflo> In reply to @nikhilsimha "Hello nim experts -": Nim tries to be safe unless checks are turned off. I wouldn't expect tight consistency and 1:1 comparisons when scrutinizing optimizations without building appropriately. Basically: use `danger` if you are actually trying to get peak performance |
02:29:07 | FromDiscord | <Elegantbeef> `-d:release` has range checks, overflow, nilchecks, ... |
02:29:23 | FromDiscord | <Elegantbeef> you also likely should use `--panics:on` |
02:29:48 | FromDiscord | <Elegantbeef> `--panics:off` is default and it impairs optimisation |
02:29:57 | FromDiscord | <Elegantbeef> Though with danger off that's unlikely to be a problem |
02:30:00 | FromDiscord | <Elegantbeef> danger on\ |
02:30:44 | FromDiscord | <nikhilsimha> sent a code paste, see https://play.nim-lang.org/#ix=html> |
02:30:56 | FromDiscord | <graveflo> nim does all kind of stuff like double checking tons of unnecessary copies (which may or may not get "optimized away") with the safety features turned on |
02:31:19 | FromDiscord | <Elegantbeef> I highly suggest using `-d:lto` |
02:31:24 | FromDiscord | <Elegantbeef> or `--passL:"-flto"` |
02:31:35 | FromDiscord | <Elegantbeef> This eliminates a whole host of optimisation issues due to how Nim compiles |
02:32:03 | FromDiscord | <albassort> I've never done inheritance in nim, why cant this proc take in a child type of the root |
02:32:23 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=html> |
02:32:27 | FromDiscord | <Elegantbeef> Are you using references? |
02:32:34 | FromDiscord | <Elegantbeef> `var Tile` |
02:33:17 | FromDiscord | <albassort> ?? |
02:33:21 | FromDiscord | <graveflo> is that a `ref ref` or am I nuts |
02:33:25 | FromDiscord | <Elegantbeef> No |
02:33:31 | FromDiscord | <Elegantbeef> I mean it's a `var ref T` |
02:33:31 | FromDiscord | <nikhilsimha> In reply to @Elegantbeef "I highly suggest using": That did the trick! |
02:33:34 | FromDiscord | <Elegantbeef> So it's pretty ugh |
02:33:53 | FromDiscord | <albassort> no solution? |
02:33:54 | FromDiscord | <albassort> :( |
02:34:04 | FromDiscord | <Elegantbeef> Drop the `var` |
02:34:08 | FromDiscord | <albassort> i dont wanna |
02:34:12 | FromDiscord | <albassort> then i gotta do ref |
02:34:16 | FromDiscord | <nikhilsimha> In reply to @graveflo "nim does all kind": I am trying to understand preferential behavior towards seq with those specific compiler flags. |
02:34:38 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
02:35:21 | FromDiscord | <albassort> n eat |
02:35:35 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
02:35:36 | FromDiscord | <Elegantbeef> Also works |
02:40:56 | rockcavera | Why did this topic disappear? https://forum.nim-lang.org/t/10844 |
02:41:14 | rockcavera | I was waiting for an answer to also understand the reason... |
02:41:42 | rockcavera | 20:42 #ย ย NimEventer | New thread by nsimha: Seq2 vs Unchecked Array performance difference , see https://forum.nim-lang.org/t/10844 |
02:45:49 | FromDiscord | <nikhilsimha> In reply to @rockcavera "Why did this topic": I wasnโt sure if I was doing something stupid |
02:50:01 | FromDiscord | <Elegantbeef> The seq and non seq versions should be fairly similar, I do imagine that it's something like Nim's `=destroy` causing deallocation slow downs making the program overall slower |
02:50:25 | rockcavera | nikhilsimha, no question is stupid |
02:51:54 | rockcavera | Elegantbeef at the time of refc I had already noticed such slowness when I tried to port wyhash... |
02:52:50 | FromDiscord | <Elegantbeef> I mean the code should be almost identical without checks on here |
02:52:57 | FromDiscord | <Elegantbeef> So I imagine it's very much destructors |
02:53:18 | FromDiscord | <Elegantbeef> inside `deallocMat` properly call `=destroy` on each float element @nikhilsimha |
02:57:01 | FromDiscord | <Elegantbeef> It's the only reason I can think that the UncheckedArray is so close to seqs but slightly faster |
03:00:02 | FromDiscord | <girvo> In reply to @Elegantbeef "This eliminates a whole": lto can't operate in compileOnly hey ๐ฆ |
03:00:16 | FromDiscord | <Elegantbeef> Of course not! |
03:00:26 | FromDiscord | <girvo> Gosh I wish I could take CMake out back and old yellar it |
03:00:35 | FromDiscord | <Elegantbeef> Don't we all |
03:01:51 | FromDiscord | <graveflo> I can hardly believe what syntax abominations they dreamed up when making cmake... it's not even old either. Not nearly enough to play that card |
03:01:51 | FromDiscord | <girvo> Does -d:lto do anything extra other than enabling -flto? |
03:01:59 | FromDiscord | <graveflo> they were smoking something really strong |
03:02:01 | FromDiscord | <girvo> In reply to @graveflo "I can hardly believe": Do _not_ get me started lol |
03:02:05 | FromDiscord | <Elegantbeef> Nope |
03:02:28 | FromDiscord | <Elegantbeef> It's supposed to be compiler agnostic `--passL: "-flto"` but it fails on mac's clang iirc |
03:03:54 | FromDiscord | <girvo> Okay sweet |
03:04:07 | FromDiscord | <girvo> I'll just bake it into our CMake then and see if it has much benefit |
03:04:14 | FromDiscord | <girvo> (for our stuff) |
03:04:29 | FromDiscord | <Elegantbeef> It helps a lot of compilers due to the fact Nim makes a module into a file |
03:04:44 | FromDiscord | <Elegantbeef> So being able to optimise all of those files together removes many issues |
03:04:51 | FromDiscord | <nikhilsimha> In reply to @Elegantbeef "inside `deallocMat` properly call": Good catch! will update |
03:05:40 | FromDiscord | <Robyn [She/Her]> Tbf can't you just, use the compile pragma in Nim on C files? |
03:05:42 | FromDiscord | <girvo> `idf_build_set_property(COMPILE_OPTIONS -flto APPEND)` man I despise CMake lmao. And ESP-IDF's usage of it, too |
03:06:47 | FromDiscord | <graveflo> sent a code paste, see https://play.nim-lang.org/#ix=html> |
03:06:58 | FromDiscord | <nikhilsimha> In reply to @Elegantbeef "The seq and non": So is the theory that in this particular setup (release + bounds off) seq gets the speed up but unchecked is 3x slower - because of the way =destroy works? But in matmul i don't call destroy - I call dealloc |
03:07:08 | FromDiscord | <Elegantbeef> No |
03:07:10 | FromDiscord | <girvo> In reply to @graveflo "I've been on a": #embedded ๐ |
03:07:18 | FromDiscord | <Elegantbeef> I do not get why it's slower ๐ |
03:07:36 | FromDiscord | <Elegantbeef> The idea is that with danger that seqs are slower due to not calling `=destroy` in your unchecked |
03:07:48 | FromDiscord | <Elegantbeef> The reason ptrs are slower I have 0 clue, you said it was on par with `-d:lto` |
03:08:01 | FromDiscord | <nikhilsimha> In reply to @Elegantbeef "The idea is that": gotcha |
03:08:18 | FromDiscord | <girvo> In reply to @graveflo "I've been on a": but that honestly looks like you're `logi`-ing a nim `string` -- its gotta be a `cstring` in logi's current definition |
03:08:37 | FromDiscord | <girvo> sent a code paste, see https://play.nim-lang.org/#ix=html> |
03:09:01 | FromDiscord | <girvo> tbh I'd remove the `string | cstring` and just make it `string` there |
03:09:06 | FromDiscord | <graveflo> still happens with that. Maybe I have to do the fancy `let x: cstring = ""` but idk. I think something else is messed up idk |
03:09:18 | FromDiscord | <michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=html> |
03:09:36 | FromDiscord | <graveflo> In reply to @girvo "tbh I'd remove the": I'll try thx |
03:09:40 | FromDiscord | <girvo> In reply to @graveflo "still happens with that.": Possibly! Post it in embedded and I'd be happy to take a look? |
03:10:14 | FromDiscord | <girvo> But `logi` in general delegates out to `ESP_LOGI` which is a macro that takes N params, etc. etc. its gross lol (through no fault of elcritch, thats just how ESP's logging system operates) |
03:10:54 | FromDiscord | <graveflo> yea that's why I took a break. I saw that C macro def and thought.. damn it. Thats just gross |
03:11:10 | FromDiscord | <girvo> yeahhhhh haha. Welcome to embedded land ๐ |
03:12:18 | FromDiscord | <Elegantbeef> The tinyusb macros are absurd |
03:12:24 | FromDiscord | <Elegantbeef> Entire DSLs |
03:12:54 | FromDiscord | <girvo> Hah yeah. esp_modem also builds a DSL in macros for it's C wrapper layer for it's C++ code... |
03:13:15 | FromDiscord | <nikhilsimha> In reply to @Elegantbeef "I do not get": who would know? |
03:13:21 | FromDiscord | <Elegantbeef> A profiler |
03:13:28 | FromDiscord | <girvo> sent a code paste, see https://play.nim-lang.org/#ix=html> |
03:13:56 | FromDiscord | <girvo> sent a code paste, see https://play.nim-lang.org/#ix=html> |
03:14:31 | FromDiscord | <girvo> In reply to @nikhilsimha "who would know?": yeah a profiler + examining the disassmbly when you work out where it's slowing down exactly via said profiling |
03:14:31 | FromDiscord | <Elegantbeef> I raise you https://github.com/hathach/tinyusb/blob/73896a3b71c525a3ee4cefa7e35ce3b3a93786ef/src/device/usbd.h |
03:14:55 | FromDiscord | <girvo> In reply to @Elegantbeef "I raise you https://github.com/hathach/tinyusb/blob": ๐คฎ |
03:14:58 | FromDiscord | <graveflo> only an AI deserves to be subjected to reading that |
03:15:16 | FromDiscord | <nikhilsimha> In reply to @Elegantbeef "A profiler": fair enough - I am going to see whats happening under a profiler. |
03:15:19 | * | azimut_ quit (Ping timeout: 240 seconds) |
03:15:34 | * | nyeaa49284230101 quit (Quit: Ping timeout (120 seconds)) |
03:15:35 | FromDiscord | <Elegantbeef> I lost so much motivation to attempt to wrap tinyusb when I seen the descriptor macros |
03:16:32 | FromDiscord | <Elegantbeef> @auxym is clearly a better person than I ๐ |
03:16:34 | FromDiscord | <girvo> Yeah I feel that. Theres a gcc flag to basically "run" a header |
03:16:49 | FromDiscord | <girvo> But that honestly doesn't always make it much better lmao |
03:17:09 | FromDiscord | <Elegantbeef> You mean `gcc -e`? |
03:17:10 | FromDiscord | <girvo> gcc -E, I think? |
03:17:57 | FromDiscord | <Elegantbeef> Yea it runs the preprocessor |
03:18:44 | FromDiscord | <Elegantbeef> I was going to replicate their C preprocessor with a Nim macro, but I never did understand what it actually did |
03:18:45 | FromDiscord | <girvo> `-dM` does... something useful too, according to my bash history lmao |
03:18:57 | FromDiscord | <Elegantbeef> bash history shame on you good sir! |
03:19:07 | FromDiscord | <Elegantbeef> I put the `sh` in shaming |
03:19:20 | FromDiscord | <girvo> Look I'm forced to use Windows with default Ubuntu on WSL2 ๐ญ |
03:19:37 | FromDiscord | <graveflo> imagine not using fish |
03:19:55 | FromDiscord | <Elegantbeef> I'm with grave |
03:20:00 | FromDiscord | <graveflo> I only said that bc I figure it would be annoying |
03:20:18 | FromDiscord | <girvo> lmao |
03:20:49 | FromDiscord | <Elegantbeef> My friend recently installed linux to do some programming stuffs and one of the first things I did was get him on fish |
03:20:58 | FromDiscord | <Elegantbeef> Friends do not let friends use bad shells |
03:21:32 | FromDiscord | <graveflo> I tried using zsh for about 2 months. The time I wasted looking up config file bs |
03:21:37 | FromDiscord | <graveflo> I will never get it back |
03:21:46 | FromDiscord | <Elegantbeef> I use stock fish |
03:21:54 | FromDiscord | <Elegantbeef> I installed it and `chsh` |
03:22:32 | FromDiscord | <Elegantbeef> Wait no stockfish is a chess thing! |
03:22:45 | FromDiscord | <girvo> hahaha |
03:22:46 | FromDiscord | <graveflo> what a blunder |
03:22:49 | FromDiscord | <girvo> !!! |
03:22:54 | FromDiscord | <Elegantbeef> More of a flounder |
03:22:59 | FromDiscord | <girvo> daaaaaaad |
03:23:02 | FromDiscord | <girvo> we talked about this |
03:23:10 | FromDiscord | <Elegantbeef> You're older than me, shut up son |
03:23:14 | FromDiscord | <girvo> ๐ |
03:23:59 | FromDiscord | <demotomohiro> In reply to @girvo "Does -d:lto do anything": `-d:lto` is implemented here: https://github.com/nim-lang/Nim/blob/devel/config/nim.cfg#L328 |
03:24:26 | FromDiscord | <Elegantbeef> Demo being more helpful than me as always |
03:24:47 | FromDiscord | <girvo> yeah so flto=auto in the CMake will work, cheers! |
03:25:29 | FromDiscord | <Elegantbeef> Girvo you do not do Nim -\> C do you? |
03:25:40 | FromDiscord | <Elegantbeef> I mean using Nim code from C |
03:26:41 | FromDiscord | <girvo> Nah we don't |
03:26:46 | FromDiscord | <girvo> Nim controls and runs the lot |
03:26:58 | FromDiscord | <girvo> sent a code paste, see https://play.nim-lang.org/#ix=html> |
03:27:07 | FromDiscord | <girvo> with -flto=auto haha |
03:27:29 | FromDiscord | <girvo> I'm guessing because of the linker scripts and hard linker mappings that embedded does |
03:27:45 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "I installed it and": Same :p |
03:27:55 | FromDiscord | <Elegantbeef> Ah shame I wanted a guinea pig for seeya ๐ |
03:28:46 | FromDiscord | <Robyn [She/Her]> In reply to @girvo "Nah we don't": 'We', you say? ๐ |
03:28:47 | FromDiscord | <girvo> hahaha well I'll have a look! It's probable we'll end up going down that path as we have an STM32 firmware now that's controlling our NB-IoT modems, that's in C. If it could call some our Nim code... |
03:29:07 | FromDiscord | <Elegantbeef> Girvo means we as a collective group of people working on a team |
03:29:10 | FromDiscord | <Elegantbeef> Not wea like you |
03:29:12 | FromDiscord | <Elegantbeef> we\ |
03:29:15 | FromDiscord | <girvo> ^^ |
03:29:23 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "Not wea like you": Didn't think that |
03:29:28 | FromDiscord | <girvo> We have a team yeah ๐ |
03:29:31 | FromDiscord | <Elegantbeef> https://github.com/beef331/seeya/blob/master/tests/mylib.nimโตhttps://github.com/beef331/seeya/blob/master/tests/mylib.h |
03:29:40 | FromDiscord | <Robyn [She/Her]> Just thought 'we' was pretty unusual in this context so was curious |
03:29:42 | FromDiscord | <Robyn [She/Her]> But neat! |
03:29:43 | FromDiscord | <Elegantbeef> Look girvo generated C headers! |
03:29:50 | FromDiscord | <Elegantbeef> Ah sorry ๐ |
03:29:52 | FromDiscord | <girvo> You see @charlie_charlie6557 in here every so often, and there's one other on the embedded team directly! |
03:29:59 | FromDiscord | <girvo> ooooooh! |
03:30:28 | FromDiscord | <Elegantbeef> And you can look at `test.c` for a raw usage |
03:30:29 | FromDiscord | <girvo> Okay that is awesome |
03:31:19 | FromDiscord | <Elegantbeef> I am dogfooding it with my libnimib experiment, but I did want to consider other things |
03:31:21 | FromDiscord | <girvo> Is it dependant on clang? |
03:31:44 | FromDiscord | <Elegantbeef> No I only use string concatenation |
03:31:50 | FromDiscord | <girvo> Oh neat ๐ |
03:31:54 | FromDiscord | <Elegantbeef> It happens all at CT in Nimscript cause I'm a fuckwit |
03:32:04 | FromDiscord | <girvo> hahaha |
03:32:15 | FromDiscord | <Elegantbeef> Also so you can easily plug things like `headers.incl "someheader.h"` |
03:32:18 | FromDiscord | <girvo> Okay I'll set it up and have a tinker! This would actually be useful now that we're moving some responsibilities to other code |
03:32:21 | FromDiscord | <Robyn [She/Her]> Aren't you supposed to use ropes for stuff like that? Or am I mistaken? |
03:32:40 | FromDiscord | <Elegantbeef> You can use ropes but they generally are not worth it |
03:32:43 | FromDiscord | <Robyn [She/Her]> I forgot how std/ropes work again |
03:32:54 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "You *can* use ropes": Why aren't they? More of a pita to work with? |
03:33:20 | FromDiscord | <Elegantbeef> Pretty much |
03:33:35 | FromDiscord | <Elegantbeef> Also not much better performance wise |
03:34:02 | FromDiscord | <Robyn [She/Her]> Isn't it better for memory because less copying? |
03:34:10 | FromDiscord | <girvo> Depends on the use case |
03:34:15 | FromDiscord | <Robyn [She/Her]> Fair |
03:34:17 | FromDiscord | <Elegantbeef> If you have many duplicate leafs |
03:34:37 | FromDiscord | <Robyn [She/Her]> Fair enough |
03:34:51 | FromDiscord | <girvo> String algorithms in general are fascinating |
03:35:43 | FromDiscord | <Robyn [She/Her]> Fair, I don't know anything about them personally |
03:35:43 | FromDiscord | <girvo> Ropes, gap buffers, etc |
03:35:50 | FromDiscord | <girvo> piece tables |
03:35:56 | FromDiscord | <Robyn [She/Her]> Gap buffers? Piece tables? |
03:35:58 | FromDiscord | <Elegantbeef> This is also running on the VM so using ropes there seems a bit silly |
03:36:18 | FromDiscord | <Robyn [She/Her]> Fair |
03:36:37 | FromDiscord | <girvo> sent a long message, see <!doctype html> |
03:36:45 | FromDiscord | <Elegantbeef> I was thinking this could be plugged in a way to support multiple backends.... one day ๐ |
03:37:04 | FromDiscord | <Elegantbeef> Export your code to Zig, Rust, Odin, .... all in one go! ๐ |
03:37:29 | FromDiscord | <girvo> In reply to @Elegantbeef "Export your code to": Imagine! ๐ |
03:37:32 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "I was thinking this": For headers/bindings only, right? |
03:37:39 | FromDiscord | <Elegantbeef> Right |
03:37:45 | FromDiscord | <Robyn [She/Her]> In reply to @girvo "https://en.wikipedia.org/wiki/Gap_buffer https://e": Neat! |
03:38:06 | FromDiscord | <Robyn [She/Her]> I should see if I get the energy to yoink Seeya's code for use in a backend for another language again |
03:38:39 | FromDiscord | <Elegantbeef> I mean it only emits typedefs |
03:38:51 | FromDiscord | <Elegantbeef> It's not a transpiler |
03:39:57 | * | tiorock joined #nim |
03:39:57 | * | tiorock quit (Changing host) |
03:39:57 | * | tiorock joined #nim |
03:39:57 | * | rockcavera is now known as Guest786 |
03:39:57 | * | Guest786 quit (Killed (erbium.libera.chat (Nickname regained by services))) |
03:39:57 | * | tiorock is now known as rockcavera |
03:40:34 | FromDiscord | <Robyn [She/Her]> Yeah but you have a code structure I can yank- |
03:40:36 | FromDiscord | <Elegantbeef> You annotate procedures or variables with expose it and it generates(most) types and the procedures |
03:40:38 | FromDiscord | <Elegantbeef> Inheritance is not presently handled though |
03:40:38 | FromDiscord | <Elegantbeef> Though it's just a `parent` iirc |
03:41:25 | FromDiscord | <Elegantbeef> Not for transpiling code |
03:41:26 | FromDiscord | <Elegantbeef> It's explicitly just procedures that return strings |
03:41:52 | FromDiscord | <Robyn [She/Her]> Fair enough |
03:42:00 | FromDiscord | <Robyn [She/Her]> I'll probably still yoink it :p |
03:43:38 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1192312359709065326/image.png?ex=65a89e6a&is=6596296a&hm=a7f153596cc95f0887f155f34b6556163d40c21b27a54fbbc859857be63c7bfe& |
03:43:41 | FromDiscord | <Elegantbeef> Well I cannot stop you |
03:43:47 | FromDiscord | <Elegantbeef> But good luck doing anything useful there |
03:44:44 | * | edr quit (Quit: Leaving) |
03:49:23 | * | Batzy joined #nim |
03:52:47 | * | Batzy_ quit (Ping timeout: 264 seconds) |
04:22:24 | FromDiscord | <spacelucy> is it possible to view the compiled C code before it gets compiled to a binary? |
04:22:57 | FromDiscord | <Elegantbeef> You can always use `--nimCache` to set where the C is pooped out then use the json task iirc |
04:23:05 | FromDiscord | <Elegantbeef> I do not recall how to do that really though |
04:24:22 | FromDiscord | <spacelucy> oh its in .cache/nim |
06:26:59 | FromDiscord | <spacelucy> how can I get the username of the current user? |
06:27:08 | FromDiscord | <spacelucy> i'm not finding much information for this |
06:29:50 | * | rockcavera quit (Remote host closed the connection) |
06:31:44 | FromDiscord | <intellij_gamer> If you are on Linux then getting the `USER` env variable should do it iirc |
06:32:49 | FromDiscord | <huantian> std/posix also provides `getlogin` from unistd.hโตhttps://nim-lang.org/docs/posix.html#getlogin |
06:33:32 | FromDiscord | <huantian> (edit) "std/posix also provides `getlogin` ... from" added "and `getlogin_r`" |
06:39:18 | FromDiscord | <spacelucy> what is a cstringโต(@huantian) |
06:41:18 | FromDiscord | <spacelucy> actually, this works good, thanksโต(@intellij_gamer) |
06:50:09 | FromDiscord | <demotomohiro> `cstring` is a `char` in C. |
06:50:27 | FromDiscord | <demotomohiro> `char` is a `string` in C. |
06:58:36 | FromDiscord | <spacelucy> oh |
07:18:38 | * | PMunch joined #nim |
07:19:21 | * | advesperacit joined #nim |
07:31:02 | * | wheatengineer joined #nim |
08:13:10 | Amun-Ra | I think * are filtered out in irc bridge |
08:14:34 | PMunch | No they're not |
08:14:44 | Amun-Ra | hmm |
08:14:56 | PMunch | Oh wait, you're also an IRC :P |
08:15:02 | FromDiscord | <pmunch> Test star |
08:15:10 | PMunch | Ah, yup |
08:15:20 | Amun-Ra | "pmunch | Test star" |
08:15:22 | PMunch | I think it's because it tries to parse Markdown |
08:15:40 | Amun-Ra | there was something wrong with "`cstring` is a `char` in C." ;) |
08:16:14 | PMunch | Haha, yeah that can get confusing fast |
08:16:39 | FromDiscord | <pmunch> Does it handle it in `inline code blocks`? |
08:16:44 | PMunch | Huh, not even there |
08:17:03 | Amun-Ra | oh |
08:17:25 | PMunch | That's strange |
08:21:37 | FromDiscord | <nnsee> how about \ this? |
08:21:54 | FromDiscord | <nnsee> or even \\ this |
08:22:25 | PMunch | Nope, that got turned into one and two backslashes respectively |
08:27:48 | Amun-Ra | `foo` - what about backticks? |
08:27:54 | FromDiscord | <nnsee> that's messed up |
08:29:58 | FromDiscord | <nnsee> char โ foo |
08:30:28 | Amun-Ra | https://ibb.co/tZKntt9 |
08:30:44 | Amun-Ra | (ยง marks nicks from proxy) |
09:47:59 | NimEventer | New thread by aiac: How to get pragma of the field in macro?, see https://forum.nim-lang.org/t/10846 |
10:43:56 | Amun-Ra | nice: https://xuanwo.io/2023/04-rust-std-fs-slower-than-python/ |
10:56:32 | FromDiscord | <gyatsoyt> hey there i am starting out in nim and i want to know that in python there are bitwise operater like bitwise or(|) and bitwise left shift(<<). what are the alternatives for these in nim |
10:58:11 | PMunch | `or` and `shl` |
10:58:51 | Amun-Ra | nim uses and/or for binary and logical operations depending on context |
11:00:26 | Amun-Ra | after writing a lot of code in nim I wrote a few times "if x or 1:" in pythonโฆ ;) |
11:02:23 | * | arkanoid joined #nim |
11:02:27 | arkanoid | hello |
11:08:57 | PMunch | Hi :) |
11:10:55 | FromDiscord | <mratsim> In reply to @gyatsoyt "hey there i am": Nim prefers full names instead of symbols, because they are hard to grep. |
11:14:21 | FromDiscord | <ezquerra> How can you check at compile time that the memory management mode is arc or orc? |
11:15:01 | FromDiscord | <pmunch> `when defined(arc) or defined(orc)` |
11:15:28 | FromDiscord | <ezquerra> thank you! |
11:16:50 | PMunch | I think that'll work |
11:21:25 | Amun-Ra | also: compileOption |
11:22:04 | FromDiscord | <gyatsoyt> sent a code paste, see https://play.nim-lang.org/#ix=html> |
11:23:34 | Amun-Ra | https://play.nim-lang.org/#ix=l%3E%3C |
11:23:37 | Amun-Ra | hmm, weird |
11:24:12 | Amun-Ra | it failed to create a share link |
11:24:28 | Amun-Ra | when compileOption("mm", "arc") or compileOption("mm", "orc"): โฆ |
11:27:54 | FromDiscord | <ezquerra> Thanks |
11:28:12 | PMunch | Amun-Ra, yeah ix.io is down so paste links don't work atm |
11:28:53 | Amun-Ra | I see, thanks |
11:29:01 | PMunch | @gyatsoyt, add an export marker after `PIECES` and it should work |
11:29:12 | FromDiscord | <ezquerra> Another, unrelated question that I've been wondering lately. Sometimes I have a variable that I need to modify at the beginning of a procedure (e.g. I need to calculate it's value in some complex way or something like that) but which then I. Is there a way to "mark" a value as "let" at a certain point. |
11:29:26 | FromDiscord | <ezquerra> (edit) "I. Is there a way" => "I'd like" | ""mark" a value" => "mark" | ""let" at a certain point." => ""constant"" |
11:29:27 | PMunch | Keep in mind though that this is a string array, you might be interested in using an enum instead |
11:29:35 | FromDiscord | <ezquerra> as if it had been defined "let" |
11:29:38 | FromDiscord | <ezquerra> Is there a way to do that? |
11:30:07 | PMunch | Not really, but you can use a block statement to assign it to a let |
11:30:20 | FromDiscord | <ezquerra> How so? |
11:30:46 | FromDiscord | <ezquerra> I |
11:31:03 | FromDiscord | <Phil> In reply to @ezquerra "Another, unrelated question that": use blocks |
11:31:20 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
11:31:30 | FromDiscord | <Phil> (edit) |
11:31:34 | PMunch | https://paste.rs/Gf2xt.txt |
11:31:51 | PMunch | Ah, you beat it to me Phil :P |
11:31:56 | FromDiscord | <Phil> Too slow ๐ |
11:32:12 | FromDiscord | <gyatsoyt> In reply to @PMunch "<@805119221091926027>, add an export": THIS RIGHT |
11:32:15 | FromDiscord | <Phil> But yeah, blocks are one of those insanely nice features for when you don't want to outsource into a new proc |
11:32:25 | FromDiscord | <Phil> But still want a type of complex assignment |
11:32:28 | FromDiscord | <gyatsoyt> |
11:32:53 | FromDiscord | <Phil> And yes |
11:32:56 | FromDiscord | <Phil> That is the export sign |
11:33:28 | FromDiscord | <Phil> Alternatively you can write `export PIECES` but typically nobody does that, it's more of a crutch for when you want to export a symbol but it gets generated |
11:33:30 | FromDiscord | <ezquerra> Thanks. That is pretty nice indeed |
11:33:34 | FromDiscord | <gyatsoyt> ty it works |
11:33:54 | FromDiscord | <Phil> (edit) "Alternatively you can write `export PIECES` but typically nobody does that, it's more of a crutch for when you want to export a symbol but it gets generated ... " added "and thus you can't directly modify it" |
11:35:40 | FromDiscord | <ezquerra> I guess what I want would be pretty hard to implement. I was thinking of having a way to tell the compiler that at some point I am done updating a certain variable, and any further updates should be a compilation error. That seems simple for "linear" code, but as soon as you have branches then it would not work... |
11:36:36 | PMunch | Yeah, that's why these blocks come in so handy :) |
11:36:38 | FromDiscord | <gyatsoyt> well it doesnt |
11:36:42 | FromDiscord | <Phil> In reply to @ezquerra "I guess what I": That sounds mostly like you should have a proc for instantiation and figure out how to put all logic inside of it |
11:37:02 | FromDiscord | <ezquerra> I guess so |
11:37:22 | FromDiscord | <ezquerra> You can of course just do `let my_constant_value = value` but then it is your responsibility to never use `value` again |
11:37:43 | FromDiscord | <pmunch> Another way would be to flip it and make everything after the initialisation logic into a block and shadow the variable |
11:38:50 | FromDiscord | <ezquerra> sent a code paste, see https://play.nim-lang.org/#ix=html> |
11:39:19 | FromDiscord | <pmunch> Yes, pretty much |
11:39:21 | * | azimut joined #nim |
11:39:27 | FromDiscord | <pmunch> sent a code paste, see https://play.nim-lang.org/#ix=html> |
11:39:38 | FromDiscord | <ezquerra> That's pretty neat |
11:39:52 | PMunch | Of course you now have an extra level of indentation |
11:40:02 | PMunch | But you could shadow more than one variable like this |
11:40:29 | PMunch | Could of course also be adapted to a template |
11:40:32 | PMunch | Or macor |
11:41:05 | PMunch | So you could do `freeze(myVar):` and that would add these shadowing let statements for all the listed variables |
11:41:34 | FromDiscord | <ezquerra> Yes, overall it is a pretty nice solution, although it would be cool to be able to do something like: `let value {.shadow.} = value` at some point in a procedure but as I said then you have problems with branckes, etc (i.e. you could maybe only do that at the top level) |
11:41:43 | FromDiscord | <ezquerra> (edit) "branckes," => "branches," |
11:41:55 | FromDiscord | <ezquerra> blocks are a really powerful feature indeed ๐ |
12:01:03 | * | casaca quit (Read error: Connection reset by peer) |
12:01:04 | * | mhcat quit (Write error: Connection reset by peer) |
12:01:04 | * | noeontheend quit (Write error: Connection reset by peer) |
12:01:04 | * | adigitoleo quit (Read error: Connection reset by peer) |
12:01:05 | * | mronetwo_ quit (Write error: Connection reset by peer) |
12:01:17 | * | adigitoleo joined #nim |
12:01:21 | * | mronetwo joined #nim |
12:01:25 | * | mhcat joined #nim |
12:01:57 | * | noeontheend joined #nim |
12:29:05 | * | casaca joined #nim |
12:31:48 | * | PMunch quit (Quit: Leaving) |
12:36:52 | * | PMunch joined #nim |
12:43:25 | * | azimut_ joined #nim |
12:44:07 | * | azimut quit (Ping timeout: 240 seconds) |
12:46:26 | * | lucasta joined #nim |
12:53:49 | * | edr joined #nim |
13:14:04 | PMunch | We don't have a way to get the name of the current function do we? |
13:14:12 | PMunch | Like `__func__` in C |
13:15:48 | Amun-Ra | technically yes, but not that simple |
13:16:16 | NimEventer | New thread by ratchet: NewProc macro question, see https://forum.nim-lang.org/t/10848 |
13:17:23 | * | jmdaemon quit (Ping timeout: 264 seconds) |
13:17:37 | * | rockcavera joined #nim |
13:18:09 | PMunch | Amun-Ra, technically yes? |
13:18:48 | Amun-Ra | PMunch: this is a part of my custom logutils module: https://dpaste.com/5D9T2R55E |
13:18:51 | Amun-Ra | see callee_procname |
13:19:12 | Amun-Ra | I use it in debug/info/โฆ templates |
13:19:57 | Amun-Ra | I need to rewrite this one, I wrote it in my early nim days |
13:22:51 | PMunch | Ah right.. |
13:23:28 | PMunch | I get the module name in a similar way in my logging module :P |
13:23:36 | Amun-Ra | :) |
13:24:52 | Amun-Ra | I use it in my image browser to treat code reading specific format as a module |
13:25:03 | Amun-Ra | https://dpaste.com/2Y3FH5JJK |
13:25:31 | FromDiscord | <Phil> In reply to @PMunch "We don't have a": My first trail of thought was "getStackTrace()" and extracting it from there. I'll be honest |
13:26:01 | PMunch | Amun-Ra, so that file is called something like png.nim? |
13:26:06 | PMunch | Obviously not PNG though |
13:26:26 | Amun-Ra | yes |
13:28:15 | Amun-Ra | and every format is defined in a const object, I sort these objects in compile time starting with formats with well known magic stringโฆ |
13:28:20 | Amun-Ra | https://dpaste.com/4NWZ72U75 |
13:28:45 | Amun-Ra | I'll release the code this year |
13:30:21 | Amun-Ra | I autodect image formats, but one can try to turn off autodetection with -f "modulename" |
13:32:08 | PMunch | Cool |
13:32:18 | PMunch | I should really try to release my logging library thing this year as well |
13:34:27 | Amun-Ra | the project already consists of over 430 nim filesโฆ ;) |
13:36:37 | PMunch | Oh wowzer |
13:36:54 | PMunch | Only counting number of files that would probably one of the biggest Nim projects |
13:38:20 | Amun-Ra | (not counting library wrappers) |
13:48:21 | PMunch | Amun-Ra, do you know what the `index` parameter to instantiationInfo does? |
13:48:27 | PMunch | It's not documented.. |
13:52:06 | Amun-Ra | PMunch: it acts like a backindex to the call stack |
13:52:44 | Amun-Ra | if you use it directly you have to use -1, if you call something that calls instantiationInfo use use -2 and so on |
13:52:47 | Amun-Ra | IIRC |
13:54:28 | PMunch | Hmm, I think I understand |
14:04:07 | * | flouer quit (Remote host closed the connection) |
14:04:27 | * | flouer joined #nim |
14:05:46 | Amun-Ra | I guess you start with -1 because 0 is instantiationInfo itself |
14:06:07 | Amun-Ra | I never looked at the source |
14:33:53 | FromDiscord | <gyatsoyt> hey there like integer in short form is int cant we use str rather than string |
14:34:27 | PMunch | `type str = string` |
14:34:29 | PMunch | There you go |
14:37:32 | FromDiscord | <gyatsoyt> In reply to @PMunch "There you go": i mean its not pre built syntax i am just assigning it |
14:37:43 | FromDiscord | <odexine> Yeah, why should it be built in? |
14:37:53 | FromDiscord | <odexine> If you want it then itโs just an extra line |
14:39:05 | PMunch | gyatsoyt, sure. The reason why it isn't built in is probably for historic reasons |
14:42:22 | PMunch | `int` being short for integer i.e. counting numbers was introduced back in the era where you used short names for everything. Back then you'd also use `char *` to mean a pointer to a string of characters. This concept was later simply abbreviated to `string` and is now used in many languages to denote a piece of text. But by this point people didn't name everything with short names so it just got called `string`. If the concept was first derived in C# or Java |
14:42:22 | PMunch | it would probably be known as `PointerToCharacterString` and created by a `PointerToCharacterStringFactory`. |
14:42:30 | PMunch | That's my best guess anyways |
14:49:28 | * | Ekho quit (Quit: CORE ERROR, SYSTEM HALTED.) |
14:56:15 | * | lucasta quit (Quit: Leaving) |
15:01:22 | * | Ekho joined #nim |
15:09:43 | PMunch | Biggest frustration with auto-wrapping C libraries is how poorly typed the originals are.. |
15:10:21 | PMunch | This one for example creates aliases for everything, but doesn't care to cast its constants to those aliased types.. |
15:10:50 | * | PMunch quit (Quit: Leaving) |
15:11:39 | arkanoid | PMunch drops mic |
15:14:30 | FromDiscord | <odexine> Please donโt drop mics, theyโre fragile |
15:18:31 | * | azimut_ quit (Ping timeout: 240 seconds) |
15:19:21 | arkanoid | odexine, not if wrapped in safe way. Ba-dum-tss |
15:19:46 | FromDiscord | <nnsee> ugh |
15:20:36 | FromDiscord | <odexine> I canโt even express how unimpressed I am |
15:21:17 | FromDiscord | <gyatsoyt> what are some alternatives for the sys module of pythonm in nim |
15:21:29 | FromDiscord | <gyatsoyt> (edit) "pythonm" => "python" |
15:22:06 | * | azimut joined #nim |
15:23:10 | arkanoid | gyatsoyt, your question should be more specific. A general answer would be https://nim-lang.org/docs/os.html |
15:25:03 | arkanoid | gyatsoyt, but if you are talking about using python interpreter inside your nim program, you have a plain wrapper of the original python sys module here https://github.com/juancarlospaco/cpython |
15:39:28 | FromDiscord | <auxym> In reply to @PMunch "Biggest frustration with auto-wrapping": Araq is right on this one, C's type system is crap. Also, it was created in the 70s, so, heh. |
16:49:59 | FromDiscord | <Phil> Another day, another attempt to fix my last remaining memory leak of 32 bytes |
16:56:01 | FromDiscord | <khazakar> Hello, I don't know if there was similar question or not, but I'd want to buy Araq's book, but not using amazon, since if it's possible to avoid giving even fracture of a cent to amazon, I'd do that. Is it possible? |
16:59:08 | FromDiscord | <kcvinker5420> How do you return Windows data types like `HWND`, `HDC` from nim to python and vice versa in nimpy ? |
16:59:49 | FromDiscord | <kcvinker5420> These are `pointer` in nim |
17:06:56 | FromDiscord | <leorize> you can convert them to uint |
17:07:35 | FromDiscord | <Phil> ~~That's it, I'm opening a fedora box just so I can have a gui~~ |
17:09:09 | FromDiscord | <Phil> Okay so deleting the pointer entries from the channelhub table does not fix the leak.โตStill, the fact that 32 bytes is the same as 4 pointers and the channelhub stores 4 pointers (2 used as keys, 2 used as values) is not lost on me... but what exactly is not accessible anymore =/ |
17:11:49 | FromDiscord | <kcvinker5420> In reply to @leorize "you can convert them": Thanks. Let me try that. ๐ |
17:14:06 | * | xet7 quit (Ping timeout: 260 seconds) |
17:16:42 | FromDiscord | <Phil> ๐คฆ |
17:17:08 | FromDiscord | <Phil> The above x100. If my hunch is right I'm about to be somewhere between happy and disappointed in myself |
17:17:32 | FromDiscord | <jviega> LOL |
17:21:30 | * | wheatengineer quit (Quit: Leaving) |
17:22:22 | FromDiscord | <Phil> I have a fucking message still rotting in one of the channels on my channelhub, when the channels get closed and destroyed that one leaks I think |
17:22:35 | FromDiscord | <Phil> ๐ซ ๐ฅ |
17:23:14 | FromDiscord | <Phil> Why do I say that? Because the leak disappears when I read all the messages from the channel first before closing the thread |
17:23:45 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
17:24:08 | FromDiscord | <Phil> Not entirely sure why it's 32 bytes though |
17:25:10 | FromDiscord | <Phil> How do you get the size of an instance in bytes again? |
17:25:46 | FromDiscord | <jviega> Is it a ref type? |
17:25:50 | FromDiscord | <jviega> If not, sizeof() works fine |
17:26:13 | FromDiscord | <jviega> Otherwise, probably sizeof(r[]) but not sure |
17:28:06 | FromDiscord | <Phil> It's... the thing that gets stuck in my channel is the message that kills the thread that reads from that channel |
17:28:37 | FromDiscord | <Phil> I lack the ability to express the emotions going through me right now |
17:31:29 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
17:32:16 | FromDiscord | <jviega> I assume there's a cycle that isn't getting cleaned up then? |
17:33:59 | FromDiscord | <Phil> sent a long message, see <!doctype html> |
17:34:22 | FromDiscord | <Phil> And the exception probably blocks destruction of the `ServerMessage` that gets read in |
17:34:30 | FromDiscord | <Phil> (edit) "blocks" => "sidesteps" |
17:34:40 | FromDiscord | <Phil> That is messed up |
17:35:34 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
17:40:06 | * | nazgulsenpai joined #nim |
17:44:00 | FromDiscord | <Phil> I have to say, the asan stacktrace was one of the least helpful I've ever seen |
17:44:09 | FromDiscord | <Phil> (On arch linux) |
17:44:48 | FromDiscord | <Phil> It pointed me literally everywhere except for the channels, only vaguely at my main() proc which yes, so happens to spawn the while-loop above among a dozen other things |
17:45:14 | FromDiscord | <Phil> Which were all nested procs as well mind you! But those didn't show up in the stacktrace whatsoever |
17:45:29 | FromDiscord | <jviega> Good error messages are hard, and Nim's particularly bad at it. |
17:46:20 | FromDiscord | <Phil> In reply to @jviega "Good error messages are": That one was on address sanitizer in part as well imo, though I guess the indirection through nim since it was analyzing nim's C output didn't help I'd wager |
17:47:08 | FromDiscord | <Phil> (I assume asan is a common abbreviation of address sanitizer, I'm new at this and like 3 folks have abbreviated that feature this way so far) |
17:48:29 | FromDiscord | <Phil> But hey, my dummy example of my lib is now leak free! |
17:48:41 | FromDiscord | <Phil> And it wasn't even my channelhub that screwed up ElegantBeef ๐ |
17:48:49 | FromDiscord | <Phil> (edit) "up" => "up," |
17:54:04 | FromDiscord | <Phil> ~~In fact, making the hub containing all channels an object rather than a ref saves me from issues with std/isolate~~ |
17:57:26 | FromDiscord | <Phil> And now to debug leaks with threading/channels and loonyqueuue |
17:57:29 | FromDiscord | <Phil> (edit) "loonyqueuue" => "loonyqueue" |
17:59:04 | FromDiscord | <Phil> ... which grants me 5 leaks all related to the allocation of the threading channels, gnaaaaa |
18:20:14 | FromDiscord | <Phil> Turns out I need to explicitly destroy the threading/channels |
18:47:31 | FromDiscord | <leorize> did you not? |
18:47:47 | FromDiscord | <leorize> I thought you did given the destroy proc you have in your example |
18:48:15 | FromDiscord | <Phil> In reply to @leorize "I thought you did": I deallocated the area in which I put the pointer |
18:48:35 | FromDiscord | <Phil> Apparently I still need to explicitly call `=destroy` on the Chan/LoonyQueue instances on top of that and forgot about it |
18:49:52 | FromDiscord | <Phil> I'll post the current iteration of the "destroy" proc for ChannelHub in a bit, cleaning up my examples to make sure they're all memory safe |
18:50:24 | FromDiscord | <leorize> have you tried tsan on them? |
18:52:01 | FromDiscord | <Phil> Not yet, one after the other was my motto so far |
18:52:32 | FromDiscord | <Phil> By first taking care of a dozen asan issues I was intending to solidify the way of searching for issues in my habits first |
18:54:04 | FromDiscord | <leorize> btw did you try the no omit frame pointer flags to see if they give you better traces? |
18:54:45 | FromDiscord | <Phil> I think I forgot those. No omit frame pointer flags were flags to apply directly to the compilation command? |
18:54:55 | FromDiscord | <Phil> Or was that requiring the fedora container/distrobox/whatnot? |
18:55:56 | FromDiscord | <leorize> yeaโต(@Phil) |
18:57:09 | FromDiscord | <leorize> using fedora container gives you better traces outside of your code (ie. ffi traces) |
18:57:28 | FromDiscord | <leorize> but anything within your code is at compile time |
19:07:34 | FromDiscord | <Phil> What is the flag called?โตDo is this -fomit-frame-pointer and I add that to the passc flag? |
19:07:37 | FromDiscord | <jviega> In C if the last item in a struct is declared to be of an array type with `[]` it allows me to alloc a variable-sized struct, based on the number of elements in that last array (so you don't need an extra indirection) 1. Is there some way to get those semantics directly in Nim (assuming no; I've never seen it), and 2. how do I declare this if I'm wrapping such a data structure?? |
19:07:39 | FromDiscord | <leorize> https://github.com/google/sanitizers/wiki/AddressSanitizerCallStackโต> AddressSanitizer uses a simple unwinder that relies on frame pointers. |
19:07:46 | FromDiscord | <leorize> looks like you do want them on |
19:08:18 | FromDiscord | <leorize> `-fno-omit-frame-pointer`โต(@Phil) |
19:08:40 | FromDiscord | <leorize> and `-mno-omit-leaf-frame-pointer` |
19:08:52 | FromDiscord | <leorize> those two are what fedora uses for it's packages |
19:09:40 | FromDiscord | <leorize> see seqs\_v2.nim in the stdlib, it uses that feature for the seq payloadโต(@jviega) |
19:09:52 | FromDiscord | <jviega> Thanks |
19:11:56 | FromDiscord | <Phil> In reply to @leorize "`-fno-omit-frame-pointer` (<@180601887916163073>)": That significantly improved the data I get |
19:12:48 | FromDiscord | <Phil> See here https://media.discordapp.net/attachments/371759389889003532/1192546191435645008/message.txt?ex=65a97830&is=65970330&hm=14e22b1b82b4bfde5b7d8dca8b6cc5dfeb18a408b12d888881e0b73a8fe4000b& |
19:13:28 | FromDiscord | <Phil> The second one is the one compiled with `nim r --cc:clang --mm:arc -d:release -d:useMalloc -f --passc:"-fsanitize=address -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer" --debugger:native --passl:"-fsanitize=address -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer" --linedir:on -d:butlerThreadin examples/ex_stdinput_async.nim` |
19:13:46 | FromDiscord | <Phil> (edit) removed "-d:butlerThreadin" |
19:14:26 | FromDiscord | <leorize> now you have new tricks to add to your wiki \:p |
19:14:55 | FromDiscord | <Phil> Already on it |
19:15:15 | FromDiscord | <leorize> they really should've mandated frame pointers for x86\_64 abi |
19:16:10 | FromDiscord | <jviega> Most Linux distros have gotten the message; I think one of the big hold-outs (Fedora IIRC?) recently announced they're finally turning them on |
19:16:57 | FromDiscord | <leorize> it's the reverse, most of them are still holding out |
19:17:13 | FromDiscord | <leorize> only fedora and ubuntu have them afaik |
19:17:15 | FromDiscord | <Phil> In reply to @jviega "Most Linux distros have": I was under the impression it was inverse |
19:17:26 | FromDiscord | <Phil> > You can improve the accuracy of the stacktraces by a lot by not omitting "frame-pointers". This is done via the flags `-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer`. They provide a minor performance penalty, but majorly improved accuracy. Fedora compiles all their packages with these flags, this is why that distro is specifically better for stacktaces and debugging.โตโตThere we go |
19:17:33 | FromDiscord | <leorize> fedora shipped it already but ubuntu is still planned for next release |
19:17:35 | FromDiscord | <jviega> Hmm, I guess I don't pay attention to most of the smaller distros |
19:19:12 | FromDiscord | <leorize> it's such a bad optimization carried over from i386 days |
19:19:13 | FromDiscord | <Phil> For reference: arch: https://gitlab.archlinux.org/daandemeyer/rfcs/-/blob/fp/rfcs/0026-fno-omit-frame-pointer.rst |
19:19:22 | FromDiscord | <Phil> That proposal was made 3 weeks ago |
19:19:51 | FromDiscord | <leorize> arm64 mandated them so you'll get good traces if you dev on an m1/2/3 by default \:p |
19:20:04 | FromDiscord | <jviega> I mean, frame pointer omission hasn't provided any significant performance boost in like 15 years or more |
19:22:16 | FromDiscord | <Phil> Actually, never mind, this is the MR: https://gitlab.archlinux.org/archlinux/rfcs/-/merge_requests/26 |
19:22:24 | FromDiscord | <Phil> (edit) removed "never mind," |
19:22:32 | FromDiscord | <Phil> The above was just the branch of the RFC |
19:22:33 | FromDiscord | <leorize> b-but muh optimizationsโตโต-- some gentoo users |
19:24:40 | FromDiscord | <leorize> soon you'll get good traces on arch too \:p |
19:25:08 | FromDiscord | <Phil> I mean, the discussion looks pretty positive so far, reading through it right now |
19:25:27 | FromDiscord | <Phil> sent a long message, see <!doctype html> |
19:25:36 | FromDiscord | <Phil> (edit) |
19:26:43 | FromDiscord | <jviega> Oh, there are all sorts of things that become a lot more difficult w/o frame pointers, including security monitoring |
19:26:51 | FromDiscord | <Phil> > Is the advantage of enabling development without recompilation worth the cost? Does anyone developing software run Arch packages for that software and thus benefit from this, or do they dogfood their work? I guess I tend to work on lower level software so would see no benefit for my work.โตSilent screams from my laptop running arch |
19:27:39 | FromDiscord | <Phil> Aaaaand โต> As a user who's not doing distro development, I don't find that I have a need for frame pointers in official packages. When I'm profiling an application, it's almost always for something that hasn't been officially released yet, so I'm building from source anyway and I can enable the frame pointer myself. Since there is going to be a performance penalty, I'd prefer for Arch to leave it disabled. |
19:28:11 | FromDiscord | <leorize> right now I use a fedora dev distro box so I don't have to care about this \:p |
19:31:08 | FromDiscord | <Phil> hmmmm leorize, I think I have a leak when there's work in the async-queue but I'm killing the thread.โตWhat would be the propper way for "emptying" the async-queue before the thread dies? |
19:31:25 | FromDiscord | <jviega> I OT |
19:31:27 | FromDiscord | <Phil> I currently have a proc that clears out the channel of the thread as well of any message still in there |
19:31:29 | FromDiscord | <leorize> get rid of the dispatcher |
19:31:38 | FromDiscord | <Phil> Already am doing that by doing setGlobalDispatcher(nil) |
19:31:50 | FromDiscord | <Phil> But given that I'm still seeing a leak I assume that doesn't suffice |
19:32:07 | FromDiscord | <leorize> if the dispatcher is gone then any queued futures should be too |
19:32:53 | FromDiscord | <leorize> unless there's an arc/orc bug, that is |
19:34:11 | FromDiscord | <Phil> Hmmm yeah that appears to not be it |
19:35:23 | FromDiscord | <leorize> is that one you sent the last leak? |
19:35:53 | FromDiscord | <Phil> Currently I'm debugging this example: https://github.com/PhilippMDoerner/ThreadButler/blob/add-loonyqueue-support/examples/ex_stdinput_async.nimโตโตThe message.txt contains the last of the 820 leaks it records https://media.discordapp.net/attachments/371759389889003532/1192551998617288715/message.txt?ex=65a97d99&is=65970899&hm=63d7635ba8191161531ebfb3a89a12b80d762316b4e75ec77087a7dfbd0dfbb9& |
19:36:43 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
19:36:52 | FromDiscord | <Phil> (edit) |
19:37:24 | FromDiscord | <Phil> (edit) |
19:37:47 | FromDiscord | <leorize> could be a leak from closure iterator |
19:38:09 | FromDiscord | <Phil> closure iterators are one of those things I always hear of and was never forced to understand |
19:38:16 | FromDiscord | <Phil> I know what each are individually, never thought about them together |
19:38:20 | FromDiscord | <leorize> looks like a string was allocated and never released |
19:38:55 | FromDiscord | <Phil> Pretty likely actually.โตThis example is about thread A sending a string ot thread B which makes an async-HTTP request to google with that string |
19:38:59 | FromDiscord | <leorize> in a way it's budget cps |
19:39:01 | FromDiscord | <Phil> I kill the server in the middle of it |
19:39:09 | FromDiscord | <leorize> you're using `recvLine`, I pity you |
19:39:22 | FromDiscord | <leorize> or well, the stdlib |
19:39:45 | FromDiscord | <Phil> In reply to @leorize "in a way it's": Okay that actually sounds funny as hell xD |
19:39:51 | FromDiscord | <Phil> I mean, isn't async kinda generally budget cps? |
19:39:59 | FromDiscord | <Phil> With really bad stacktraces? |
19:40:11 | FromDiscord | <leorize> anyhow, looks like the string allocated during async `recvLine` is not destroyed |
19:40:15 | FromDiscord | <leorize> your leak said nothing about the closure itself |
19:40:33 | FromDiscord | <leorize> cps is lower level than async \:p you can make the same async API with cps |
19:40:54 | FromDiscord | <leorize> but it is specifically the string that leaks |
19:41:11 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
19:41:20 | FromDiscord | <Phil> I think the string in question might just be the return of the HTTP request or sth |
19:42:03 | FromDiscord | <leorize> yea, your trace said `recvLine` |
19:42:03 | FromDiscord | <leorize> which is the most horrendous thing to ever exist in the stdlib |
19:42:59 | FromDiscord | <Phil> Ah, is that the kind of thing that made Dom so infamous? |
19:43:07 | FromDiscord | <Phil> Or rather his code |
19:44:54 | FromDiscord | <leorize> nah, dom is infamous for his attitude |
19:45:06 | FromDiscord | <leorize> bad code is fixable, bad attitude less so |
19:48:15 | FromDiscord | <leorize> @Phil\: do you only have the indirect leak and not any direct ones? |
19:49:46 | FromDiscord | <Phil> as far back as my stacktrace goes, I can't seem to pipe the asan output into a file |
19:50:04 | FromDiscord | <Phil> When I do it just prints to stdin anyway |
19:50:40 | FromDiscord | <Phil> Looking for flags in the google docs |
19:51:10 | FromDiscord | <Phil> as far back as my terminal goes |
19:51:17 | FromDiscord | <leorize> `2>&1` then you can pipe |
19:51:23 | FromDiscord | <leorize> asan prints to stderr |
19:51:40 | FromDiscord | <leorize> so route it back to stdout and you get to pipe |
19:51:49 | FromDiscord | <leorize> some shells can do `2|` which pipes only stderr |
19:52:33 | FromDiscord | <leorize> looks like bash can do `|&` which pipes both stderr and stdout |
19:54:37 | FromDiscord | <Phil> There we go, alright, looking for direct leaks |
19:55:56 | FromDiscord | <Phil> In reply to @leorize "<@180601887916163073>\: do you only": Nope, all indirect leaks |
19:57:25 | FromDiscord | <Phil> 57 indirect leaks in fact, most 10-20 bytes |
19:57:48 | FromDiscord | <Phil> If you want to check yourself https://media.discordapp.net/attachments/371759389889003532/1192557510205378670/message.txt?ex=65a982bb&is=65970dbb&hm=cab4d4132debc893602037f7bc04210d34f01f13c6262c48d3fcaba731702e28& |
19:58:24 | FromDiscord | <leorize> smells like cycles to me |
19:59:16 | FromDiscord | <mratsim> In reply to @jviega "I mean, frame pointer": I'm really counting every single register available on x86 for cryptography: https://github.com/mratsim/constantine/blob/master/constantine%2Fmath%2Farithmetic%2Fassembly%2Flimbs_asm_mul_mont_x86_adx_bmi2.nim#L29 |
19:59:58 | FromDiscord | <leorize> you can annotate your proc to have rbp/asan off you know |
20:00:11 | FromDiscord | <Phil> ... you can what now? |
20:00:22 | FromDiscord | <Phil> Or is that directed at mratsim? |
20:00:25 | FromDiscord | <mratsim> details: https://github.com/mratsim/constantine/blob/master/constantine%2Fmath%2Farithmetic%2Fassembly%2Flimbs_asm_mul_mont_x86_adx_bmi2.nim#L210 |
20:00:51 | FromDiscord | <mratsim> In reply to @leorize "you can annotate your": there is a single proc in the file so localpassC is fine |
20:01:10 | FromDiscord | <leorize> and like, if you are working with bare assembly at this point, does it even matter if rbp is available? you can just push it out of the way (I mean, you have to per x86\_64 ABI anyways) |
20:02:27 | FromDiscord | <mratsim> In reply to @leorize "and like, if you": you cannot push/pop the stack with inline ASM, it messes up the C compiler |
20:02:59 | FromDiscord | <mratsim> otherwise you need asm-no-stackframe but then you need to do all bookkeeping ypurself |
20:05:41 | FromDiscord | <jviega> Exactly. And I call shenanigans on one register making a significant difference on anything crypto related anyway. Slow-path for most important primitives is pushed down into the hardware like PCLMULQDQ or is SO slow in a relative sense (elliptic curve math) that it's hardly important. Nor that I can think of any algorithm not pushed to hardware where I couldn't make due easily with the remaining general purpose registers |
20:13:02 | FromDiscord | <leorize> isn't that what you should be using in this case? |
20:13:02 | FromDiscord | <leorize> you're dependent on the exact x86\_64 ABI and while all of them should handle those registers for you, it's probably better to take the reign and enforce an ABI |
20:13:04 | FromDiscord | <leorize> although I think you could just mess with rbp directly even without `-fno-omit-frame-pointer`, but I don't know if gcc/clang would generate code dependent on rbp then |
20:13:06 | FromDiscord | <leorize> my impression atm is that it'd just make `rbp` set to the frame but not use it directly for math |
20:20:02 | FromDiscord | <jviega> People continually pursue "as fast as possible" without a lot of data, and when they're likely way past "much faster than it needs to be", at the expense of a lot of other important considerations. I've been guilty too. But there were software implementations of GCM-AES 20 years ago easily doing 1gb/sec back when it was 40 cycles per byte and all in software. Now it's hardware and close to 1 cycle per byte. |
20:21:24 | FromDiscord | <mratsim> In reply to @jviega "People continually pursue "as": The cryptographic code I'm looking at at my day job needs 100+ GPU to reliably generate proofs in the time budget, 1h. |
20:22:03 | FromDiscord | <mratsim> We're inventing new curves and protocols, we're looking into FPGA and investing into ASICs |
20:22:34 | FromDiscord | <mratsim> if we can use clusters of CPUs with 300+ cores it would be cheaper. |
20:22:57 | FromDiscord | <jviega> Great, then you have far more levers that will provide far more value than a frame pointer. |
20:23:00 | FromDiscord | <leorize> @Phil\: have you tried orc? |
20:23:07 | FromDiscord | <Phil> In reply to @leorize "<@180601887916163073>\: have you tried": Not yet |
20:23:31 | FromDiscord | <dedraiaken> @mratsim do you have an intuition on whatโs achievable speed-wise with asics versus implementation on a cpu or gpu? |
20:24:12 | FromDiscord | <mratsim> In reply to @jviega "Great, then you have": The algorithm needs 15 registers, otherwise you needs to switch to another modmul algo which is anywhere from 20% to 70% slower (if you just let the compiler do its things) |
20:24:22 | FromDiscord | <leorize> give it a go. I don't know how nim's async works wrt chaining but in cps we do have cycles from function calls (that's solved manually, but won't be if you drop the continuation)โต(@Phil) |
20:24:30 | FromDiscord | <Phil> arc leaks 25017 bytesโตorc leaks 8393 bytesโตI leak understanding |
20:24:46 | FromDiscord | <Phil> (edit) "arc" => "orc" | "bytesโตorc" => "bytesโตarc" |
20:25:19 | FromDiscord | <Phil> orc almost exactly triples the leak |
20:25:25 | FromDiscord | <mratsim> In reply to @dedraiaken "<@570268431522201601> do you have": you can get 1x but 10x less power usage, or you can get say 50x. My bottleneck at the moment is memory. Some stuff requires 1TB of memory >_> |
20:25:57 | FromDiscord | <mratsim> another axis is renting cost |
20:26:15 | FromDiscord | <albassort> In reply to @isofruit "orc leaks 25017 bytes": hmmmmmm |
20:26:17 | FromDiscord | <mratsim> with AIs monopolizing GPUs, having CPU algorithms is nice. |
20:26:23 | FromDiscord | <dedraiaken> Yeah those gpu rental are pricey |
20:26:37 | FromDiscord | <albassort> but gpus are cool |
20:26:52 | FromDiscord | <leorize> any traces?โต(@Phil) |
20:27:05 | FromDiscord | <albassort> would you rather be a cpu or a gpu |
20:27:10 | FromDiscord | <albassort> i'd rather be a gpu personally |
20:28:00 | FromDiscord | <mratsim> In reply to @leorize "although I think you": iirc I tried but after losing a day on it, I decided not to use push/pop and not deal with asm-no-stackframe. |
20:28:39 | FromDiscord | <Phil> In reply to @leorize "any traces? (<@180601887916163073>)": Here ya go https://media.discordapp.net/attachments/371759389889003532/1192565276663881868/message.txt?ex=65a989f6&is=659714f6&hm=9b3e2c112641aa372cf98f4d7018461f07feb4bd185de812db3873b69111be22& |
20:29:15 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
20:29:27 | FromDiscord | <Phil> Complains about the same spots |
20:29:43 | FromDiscord | <leorize> you got a single direct leak |
20:29:44 | FromDiscord | <Phil> from what I can see by skimming |
20:30:07 | FromDiscord | <Phil> Ohhh the first thing is a direct leak |
20:30:14 | FromDiscord | <albassort> phil are you still making that thing that you needed to wrap into a macro and thread |
20:30:35 | FromDiscord | <leorize> you got a leak from... destroying the queue? what |
20:31:00 | FromDiscord | <Phil> Is it complaining in this very specific circumstances about me nilling the global dispatcher? |
20:31:21 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
20:31:48 | FromDiscord | <Phil> In reply to @albassort "phil are you still": If you mean the threadServer thing - yes.โตI'm at the point where it's electric boogaloo, with insanity and memory debugging |
20:32:14 | FromDiscord | <leorize> what is the impl of this `runServerLoop`? |
20:32:15 | FromDiscord | <Phil> Thanks to leorize and mratsim I'm slowly coming around to the "easier" of the leaks I made, though this async one stumps me |
20:32:20 | FromDiscord | <leorize> looks like it's not from destroying the dispatcher |
20:32:30 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
20:32:31 | FromDiscord | <Phil> Should it? |
20:32:33 | FromDiscord | <leorize> but from hasPendingOperations? |
20:33:12 | FromDiscord | <Phil> hasPendingOperations is an asyncdispatch thing which checks if there are any procs timers or the like registered |
20:33:29 | FromDiscord | <Phil> So if that one's busted, I wash my hands in innocence and not the red blood of memory leakage |
20:33:36 | FromDiscord | <leorize> I think you didn't even get to the setGlobalDispatcher line |
20:35:32 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
20:35:44 | FromDiscord | <Phil> (handleRequestOnServer is a proc defined by the user) |
20:35:49 | FromDiscord | <Phil> (edit) "user)" => "user, I just emit it here)" |
20:36:12 | FromDiscord | <leorize> can you put the entire file inside `expandMacros` then post it here? |
20:36:13 | FromDiscord | <Phil> So it should create a globaldispatcher (?) |
20:37:55 | FromDiscord | <albassort> In reply to @isofruit "If you mean the": The psychwards in germany are well staffed i ear |
20:37:58 | FromDiscord | <albassort> (edit) "ear" => "hear" |
20:38:25 | FromDiscord | <Phil> In reply to @albassort "The psychwards in germany": You heard wrong, half of them are on the verge of collapse and the other half left the sector because of terrible wages |
20:38:36 | FromDiscord | <Phil> In reply to @leorize "can you put the": That may take a bit, I'm getting compiler errors when I do that |
20:38:47 | FromDiscord | <albassort> In reply to @isofruit "You heard wrong, half": in comparison to New York |
20:39:08 | FromDiscord | <Elegantbeef> Yes I mentioned this prior!โต(@Phil) |
20:40:24 | NimEventer | New thread by arnetheduck: `nph` opinionated formatter v0.3, see https://forum.nim-lang.org/t/10850 |
20:41:40 | FromDiscord | <khazakar> Looks nice ๐ Will definitely use it for my language learning journey :P) |
20:41:41 | FromDiscord | <khazakar> (edit) ":P)" => "๐" |
20:42:00 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
20:42:19 | FromDiscord | <Phil> In reply to @khazakar "Looks nice ๐ Will": It's pretty nphty |
20:43:06 | FromDiscord | <kcvinker5420> @leorize Passing HWND to python as uint is okay. But how do we get an HDC from python ? |
20:43:42 | FromDiscord | <leorize> all of them are just `HANDLE` variants, right? then `uint` works for all |
20:44:03 | FromDiscord | <Elegantbeef> Expand the macro phil |
20:44:14 | FromDiscord | <Elegantbeef> It's likely using silly line info |
20:44:27 | FromDiscord | <Elegantbeef> Copy your line info kids! |
20:45:35 | FromDiscord | <Phil> I mean, this is what it currently outputs (with the error I posted before) https://media.discordapp.net/attachments/371759389889003532/1192569535069425675/message.txt?ex=65a98dee&is=659718ee&hm=ffe9429c02b8d01e8fa1e5ab55f33d6d66ff9eefa4a2fa21be1db8b5afaf2636& |
20:46:18 | FromDiscord | <Phil> Though I guess that appears to be the entire file |
20:46:32 | FromDiscord | <leorize> just typed macros shenanigans, don't worry about it |
20:46:53 | FromDiscord | <Phil> Given that it ends on destroy(hub) which seems accurate as that is the last line on the file and I insert nothing after it |
20:47:51 | FromDiscord | <Elegantbeef> Also the `pure` is practically pointless with modern Nim |
20:48:05 | FromDiscord | <Elegantbeef> I do not see any reason for that error to appear |
20:48:18 | FromDiscord | <Elegantbeef> Oh wait |
20:48:52 | FromDiscord | <Elegantbeef> I wonder if you accidently reuse the same symbol for `ServerKinds` and `MainKinds` |
20:49:32 | FromDiscord | <leorize> it works without `expandMacros`, beef |
20:49:37 | FromDiscord | <Elegantbeef> Oh |
20:49:45 | FromDiscord | <kcvinker5420> In reply to @leorize "all of them are": Yes they are |
20:49:46 | FromDiscord | <Phil> Also I explicitly made that impossible |
20:50:04 | FromDiscord | <Elegantbeef> Then I assume that expandmacros somehow nukes the symbols somehow ๐ |
20:50:19 | FromDiscord | <Phil> Basically the kinds are generated from message types you pass in.โตI force those to be unique based on symbol name.โตSo if one message type contains a type called "Bla", another can not or I won't compile. |
20:50:29 | FromDiscord | <leorize> expandMacros is like repr + return |
20:50:32 | FromDiscord | <leorize> just nim being nim |
20:51:07 | FromDiscord | <Phil> The one enum-kind that isn't is Kill<ThreadName>Kind and thread names are also forced to be unique IIRC |
20:51:23 | FromDiscord | <leorize> you know you could `gensym` enum names, right? |
20:51:33 | FromDiscord | <kcvinker5420> @leorize Python saysโต`TypeError: Cannot convert python object to uint` |
20:52:00 | FromDiscord | <leorize> you meant you got an HDC in python?โต(@kcvinker5420) |
20:52:14 | FromDiscord | <kcvinker5420> In reply to @leorize "you meant you got": Yes, I am using ctypes |
20:52:16 | FromDiscord | <Phil> In reply to @leorize "you know you could": Sure that was I can of worms I didn't want to deal with yet.โตThat's a possible generalization I'm willing to deal with if somebody actually cares about it |
20:52:19 | FromDiscord | <leorize> what libraries are you using for those? |
20:52:22 | FromDiscord | <Phil> Not like the workaround for it is difficult. |
20:52:23 | FromDiscord | <leorize> oh ctypes |
20:52:29 | FromDiscord | <kcvinker5420> Yeah' |
20:52:37 | FromDiscord | <Phil> Perfect is the enemy of good and all that. |
20:54:10 | FromDiscord | <leorize> if you can use ctypes then high chance you can just pass the pointer straight back |
20:55:43 | FromDiscord | <kcvinker5420> nimpy is not accepting the HDC |
20:57:10 | FromDiscord | <kcvinker5420> sent a code paste, see https://play.nim-lang.org/#ix=html> |
20:57:38 | FromDiscord | <kcvinker5420> This is when I use plain HDC in nim |
20:58:50 | FromDiscord | <Phil> Okay I'm not seeing anything, I'm doing lunch |
20:59:06 | FromDiscord | <Phil> Or rather, dinner... which I actually forgot if I had, dang |
21:00:26 | FromDiscord | <Elegantbeef> Hey in some dialects lunch is dinner |
21:00:40 | FromDiscord | <leorize> @Phil\: from what I can tell, the leak is probably nim's fault |
21:00:53 | FromDiscord | <Elegantbeef> Trick statement, when is it not?! |
21:02:21 | FromDiscord | <Phil> Easy, whenever I write more than 5 lines of code |
21:02:33 | FromDiscord | <Elegantbeef> Leo do you remember the Nim ABI for inheritance off hand, is it a prefixed pointer to the parent type or the type info? |
21:02:49 | FromDiscord | <leorize> the typeinfo is in RootObj |
21:03:22 | FromDiscord | <leorize> inheritance is just `struct X { super_t super; <your fields here> }` |
21:03:50 | FromDiscord | <Elegantbeef> Thought it was `super_t` |
21:03:53 | FromDiscord | <leorize> note that the type information data is not populated if you just create a zero-ed memory location, you'd have to run the constructor |
21:04:09 | FromDiscord | <Elegantbeef> Oh I know all of this, it's for the header generator |
21:04:22 | FromDiscord | <Elegantbeef> I do not have inheritance support at the moment ๐ |
21:04:43 | FromDiscord | <leorize> you can just look at `sizeof()` to see what it is \:p |
21:04:52 | FromDiscord | <Elegantbeef> Yea I can just look at the generated code |
21:05:16 | FromDiscord | <leorize> it's probably better to just make inherited types opaque |
21:05:16 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1192574490757042216/image.png?ex=65a9928b&is=65971d8b&hm=8aab9c7088ae2330c43c6c3c5c64fd108193edcf822452988eed985a9f8f8bf5& |
21:05:17 | FromDiscord | <Elegantbeef> This seems like a fine example though |
21:05:32 | FromDiscord | <Elegantbeef> Well the benefit in exposing the structs is you can access the fields |
21:05:53 | FromDiscord | <Elegantbeef> Like it's much safer to expose all your ref types/sequences as opaque |
21:06:00 | FromDiscord | <leorize> do you want to handle the gymnastic required to access overridden fields? |
21:06:42 | FromDiscord | <leorize> and like, you're at the mercy of nim abi when you generate the object fields |
21:06:43 | FromDiscord | <Elegantbeef> What? |
21:07:33 | FromDiscord | <Elegantbeef> Do you mean inherited fields? |
21:07:55 | FromDiscord | <leorize> yea |
21:08:14 | FromDiscord | <Elegantbeef> I mean if you want to expose inheritance to the C-api why not ๐ |
21:08:47 | FromDiscord | <Elegantbeef> Probably best to just not support inheritance objects |
21:08:54 | FromDiscord | <Elegantbeef> Too easy to fuck things up there |
21:09:06 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
21:09:30 | FromDiscord | <leorize> that sounds dangerous \:p |
21:09:45 | FromDiscord | <Elegantbeef> Indeed |
21:09:50 | FromDiscord | <leorize> you can have like a nim-c stdlib where you define helpers to access those data |
21:10:18 | FromDiscord | <Elegantbeef> Nah I do not want to expose any procedures the user does not define |
21:11:00 | FromDiscord | <leorize> no, like providing an auxiliary header with utilities for those |
21:11:26 | FromDiscord | <leorize> so make seq and stuff opaque and tell them to include this header to get tools to mess with those \:p |
21:12:07 | FromDiscord | <Elegantbeef> Well those cannot really be opaque as they need `intptr_t, data` |
21:12:34 | FromDiscord | <leorize> why not? |
21:13:39 | FromDiscord | <Elegantbeef> Well I can make them `struct seq {len, data}` |
21:14:02 | FromDiscord | <Elegantbeef> But that loses type info |
21:16:49 | FromDiscord | <leorize> I think for safety you can make them `struct seq_int { char[N] opaque; }` and add a bunch of `int seq_int_at(struct seq_int x, intptr_t offset);` |
21:16:57 | FromDiscord | <leorize> but you're still at the mercy of nim abi that way... |
21:17:02 | FromDiscord | <leorize> well I guess there's no easy route |
21:17:16 | FromDiscord | <Elegantbeef> I mean yea this depends on Nim's string/seq impl |
21:17:24 | FromDiscord | <Elegantbeef> Which is why I error if you do not use arc/orc ๐ |
21:17:39 | FromDiscord | <leorize> and then one day newnewruntime lands \:p |
21:17:51 | FromDiscord | <Elegantbeef> Oh noes I have to change some procedures! |
21:18:09 | FromDiscord | <leorize> it'll be horrendous if nim ever gets SSO |
21:18:45 | FromDiscord | <Elegantbeef> Luckily Araq presently says the best way to use those is a library so... give it a few years |
21:20:06 | FromDiscord | <Elegantbeef> I guess I do need a proc to get the actual len from the sequences |
21:20:20 | FromDiscord | <Elegantbeef> Since it's actually len shr 1 iirc |
21:20:47 | FromDiscord | <Elegantbeef> Or is it the first 63 bit |
21:21:59 | FromDiscord | <Phil> SSO? |
21:22:11 | FromDiscord | <Elegantbeef> Short string optimisation |
21:22:24 | FromDiscord | <Elegantbeef> You store small strings on the stack but large ones with a pointer indirection |
21:22:38 | FromDiscord | <Elegantbeef> So any equal to or smaller than the size of a pointer |
21:22:44 | FromDiscord | <Elegantbeef> I kid |
21:22:55 | FromDiscord | <Elegantbeef> It's any string of a fixed size usually like 32 bytes |
21:23:16 | FromDiscord | <Elegantbeef> https://github.com/planetis-m/ssostrings |
21:23:22 | FromDiscord | <Elegantbeef> For a Nim impl |
21:25:18 | FromDiscord | <leorize> I think you just have to mask the static bit out |
21:25:36 | FromDiscord | <Elegantbeef> Yea I think it's the 64th bit |
21:25:52 | FromDiscord | <leorize> might as well make the string opaque \:p |
21:26:18 | FromDiscord | <Elegantbeef> Oh wait it's the capacity |
21:26:32 | FromDiscord | <Elegantbeef> The strlit is inside the capacity! |
21:26:40 | FromDiscord | <Elegantbeef> We do not need to mask anything ๐ |
21:26:45 | FromDiscord | <kcvinker5420> @leorize It compiled when I use `PyObject` |
21:26:45 | FromDiscord | <leorize> nice |
21:27:07 | FromDiscord | <kcvinker5420> Do I need to convert it back to an HDC ? |
21:27:32 | FromDiscord | <kcvinker5420> Or is there any in-build conversion methods in PyObject from Nim |
21:27:42 | FromDiscord | <kcvinker5420> (edit) "Nim" => "NimPy" |
21:28:00 | FromDiscord | <Elegantbeef> A nice macro of `seq_get_at(a, ind)` might be worthwhile though in an header |
21:28:00 | FromDiscord | <leorize> In reply to @kcvinker5420 "Or is there any": no idea, I'm not a nimpy user |
21:28:13 | FromDiscord | <kcvinker5420> Okay] |
21:29:40 | FromDiscord | <Elegantbeef> To be the devils advocate leo if one wants them to be opaque they can always make a `type Opaque[T] = distinct T` and make their own `toTypeDefs` and `toCType` procs ๐ |
21:31:00 | FromDiscord | <leorize> why not opaque then transparent on request? xd |
21:31:17 | FromDiscord | <Elegantbeef> Uhh |
21:31:28 | FromDiscord | <leorize> if you're working with C you can't destroy seqs over there anyways |
21:33:31 | FromDiscord | <leorize> there's so little that could be done in C without routing back to Nim that it might be better to figure out a way to take the raw pointers and send a `len + data` pair to C |
21:33:37 | FromDiscord | <leorize> basically normalizing the repr |
21:34:12 | FromDiscord | <Elegantbeef> Well i can just emit a `intptr_t, void` and a `seq_T_get_data` and `seq_T_index` |
21:34:35 | FromDiscord | <leorize> technically you could emit `intptr_t, T` with some magic \:p |
21:36:01 | FromDiscord | <leorize> something like `proc toC(sink seq[T]): Cseq[T]` |
21:36:02 | FromDiscord | <leorize> then you can support both refc and arc/orc |
21:36:02 | FromDiscord | <leorize> but it'd be trouble for the ones in structures, hmm |
21:37:50 | FromDiscord | <Elegantbeef> Yea using a void\ is likely the sanest |
21:37:50 | FromDiscord | <Elegantbeef> I do not care about supporting refc myself |
21:39:44 | FromDiscord | <Elegantbeef> If one really wanted to use refc fork it to emit `struct string{ void}` ๐ |
21:39:44 | FromDiscord | <leorize> lol |
21:39:45 | FromDiscord | <Elegantbeef> Atleast iirc a refc string/seq was a pointer indirect struct |
21:40:23 | FromDiscord | <Elegantbeef> The one annoying thing though is that if I emit procs for getting data/len it pollutes the header so I need an utils header that includes the other header |
21:41:24 | FromDiscord | <leorize> the joys of FFI |
21:41:48 | FromDiscord | <Elegantbeef> And then on C the utils header becomes the important header ๐ |
21:42:15 | FromDiscord | <Elegantbeef> Oh wait I'm dumb |
21:42:33 | FromDiscord | <Elegantbeef> I can just emit both typedefs |
21:42:55 | FromDiscord | <Elegantbeef> Well all three |
21:44:13 | FromDiscord | <Elegantbeef> Though that makes it like `(struct string_transparent)(myString).data->data` |
21:45:20 | FromDiscord | <leorize> you can just tell the user that they should really output a proper C type if they want to make a C lib \:p |
21:46:18 | FromDiscord | <leorize> nim seq/strings should just be used during development |
21:46:19 | FromDiscord | <leorize> that would let you get away with generating all kind of helpers in a single header |
21:50:07 | FromDiscord | <Elegantbeef> I need to look at other libraries |
21:50:08 | FromDiscord | <Elegantbeef> GLib for instance exposes their details |
21:53:23 | FromDiscord | <leorize> glib is also stable as hell |
21:53:25 | FromDiscord | <Elegantbeef> You underestimate my willingness to write a new string/seq impl ๐ |
21:53:27 | FromDiscord | <leorize> technically anything using C++ STL also have their innards exposed |
21:53:29 | FromDiscord | <leorize> just that they are also pretty damn stable |
21:53:29 | FromDiscord | <Elegantbeef> The way I see it if the Nim runtime changes enough that's why you version your libraries |
21:53:30 | FromDiscord | <leorize> until you use boost and it breaks every point release |
21:53:31 | FromDiscord | <Elegantbeef> You can target libname.so.1 only |
21:55:21 | FromDiscord | <Elegantbeef> I do hate this problem as there is no straightforward correct answer |
21:58:32 | FromDiscord | <Elegantbeef> Wait C has `const` does that prevent changing where pointer fields point? |
21:58:32 | FromDiscord | <leorize> my view is that if you use stdlib stuff, you're at risk of stdlib pulling the rug under you |
21:58:32 | FromDiscord | <leorize> no, const apply to what the pointer points to |
21:58:33 | FromDiscord | <leorize> kinda stupid like that |
21:58:33 | FromDiscord | <Elegantbeef> Ugh |
22:32:44 | FromDiscord | <Elegantbeef> Well leorize I've decided to go for |
22:32:44 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1192596504079245332/image.png?ex=65a9a70b&is=6597320b&hm=68de72ac67cb99f1682fc0a6c6eea553c82aa2d8cb68f6e6404c9a757a65d5c6& |
22:32:57 | FromDiscord | <Elegantbeef> Users can either use `string` or the opaque variation to make it safer |
22:33:07 | FromDiscord | <Elegantbeef> Though it still exposes the `void data` it's still slightly safer |
22:33:54 | FromDiscord | <Elegantbeef> Users still also have to define their own procs to operator on the `OpaqueSeq[T]` but bleh |
22:39:58 | FromDiscord | <leorize> hmm why not the other way around? |
22:40:33 | FromDiscord | <Elegantbeef> Making it harder to wrap the code seems like an opt-in thing to me |
22:40:57 | FromDiscord | <Elegantbeef> Atleast as is you can use tool wrapping on the generated header for `string` and have the basis to implement `[]` in any language |
22:41:13 | FromDiscord | <Elegantbeef> With fully opaque types `[]` cannot be implemented in any consuming language |
22:41:55 | FromDiscord | <Elegantbeef> Well it can be but only if you know the `void` points to `(int, ptr T)` |
22:43:25 | FromDiscord | <leorize> shouldn't there be helpers for `[]`? |
22:43:46 | FromDiscord | <leorize> if you can reach it in C then you should be able to do it in any language, no? |
22:44:11 | FromDiscord | <Elegantbeef> I do not like utils header idea and I do not want to expose more procedures than the user defined in Nim |
22:44:16 | FromDiscord | <Elegantbeef> So there is no pretty way to me |
22:45:50 | FromDiscord | <leorize> then what is the use case for opaque seqs/strings/refs? to pass to another nim thing? |
22:48:43 | FromDiscord | <Elegantbeef> `Opaque`s are meant to be only ever passed to Nim procedures and never interacted with from the FFI side |
22:48:44 | FromDiscord | <Elegantbeef> The way I see it if you want safety you should use opaque types and write any accessing code inside Nim |
22:48:44 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
22:48:44 | FromDiscord | <Elegantbeef> `mylib_opaque_seq_int_data` is a proc I wrote specifically for querying the data ptr |
22:48:53 | FromDiscord | <leorize> I guess that sounds about right |
22:49:00 | FromDiscord | <leorize> wait how are you gonna destroy those things? |
22:49:10 | FromDiscord | <Elegantbeef> You manually make a `destroy` proc and expose that |
22:49:23 | FromDiscord | <leorize> no, like, for the non-opaque one |
22:49:28 | FromDiscord | <Elegantbeef> The same way |
22:49:42 | FromDiscord | <leorize> lol so you have to write something either way |
22:49:55 | FromDiscord | <Elegantbeef> For now atleast |
22:50:01 | FromDiscord | <Elegantbeef> I do not want to have hidden exposed symbols |
22:50:17 | FromDiscord | <leorize> I guess you can write helpers for the user to generate those symbols |
22:50:35 | FromDiscord | <leorize> like `genSeqProc(seq[int], "myprefix_")` |
22:50:42 | FromDiscord | <Elegantbeef> Yea |
22:51:03 | FromDiscord | <Elegantbeef> I do also have to check if `exportc` uses that `--nimMainPrefix` |
22:51:15 | FromDiscord | <Elegantbeef> If so that's a much nicer approach to the str formatter ๐ |
22:51:48 | FromDiscord | <Elegantbeef> Oh and now I have that TS issue that one person had |
22:52:06 | FromDiscord | <Elegantbeef> I dumbly ran `TSUpdate` and it broke! |
22:52:20 | FromDiscord | <leorize> do a `TSInstall! nim` and see if that fixes it |
22:53:04 | FromDiscord | <Elegantbeef> Nope |
22:53:11 | FromDiscord | <leorize> make sure all of your TS plugins are up-to-date |
22:53:56 | FromDiscord | <Elegantbeef> Aww it does not use nimMainPrefix |
22:54:04 | FromDiscord | <leorize> what commits are you on for the TS stuff? |
22:54:16 | FromDiscord | <leorize> I wonder if there's an easy way to get a list... |
22:55:51 | FromDiscord | <leorize> and do you have a nvim config that you can share? |
22:56:33 | FromDiscord | <Elegantbeef> my init.lua is pretty stock from astronvim |
22:56:45 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
22:56:57 | FromDiscord | <leorize> hmm both users with issues use astronvim |
22:57:01 | FromDiscord | <Elegantbeef> Infact I do not think I added anything |
22:59:52 | FromDiscord | <leorize> I'm loading a container with astronvim and it doesn't seem to like me |
23:01:06 | FromDiscord | <leorize> managed to repro it |
23:02:59 | FromDiscord | <leorize> yea it's an astronvim bug beef |
23:03:28 | FromDiscord | <leorize> they're pinning an older version of nvim-treesitter-textobjects for some reason |
23:08:18 | FromDiscord | <Phil> Seeing chronicles pop up every now and again in the asan records is so weird |
23:08:40 | FromDiscord | <leorize> they happened to pin the exact commit before the this one lol\: https://github.com/nvim-treesitter/nvim-treesitter-textobjects/commit/381c7326a5e8fff4e29b7ddc4ae486c0d6c07021 |
23:09:29 | FromDiscord | <leorize> I think you can update the config to pin the newer version so TS works |
23:09:38 | FromDiscord | <Phil> Still trying to wrap my head around what the hell is happening here that could possibly be leaking.โตI mean, it's just 112 bytes, but it annoys me that I can't get all my examples squeaky perfect https://media.discordapp.net/attachments/371759389889003532/1192605791933431828/message.txt?ex=65a9afb2&is=65973ab2&hm=a42435255372b940db3947d61e4c6f619d5271d453e36ad9013b524f8ff2e4ce& |
23:10:41 | FromDiscord | <Phil> From what I'm understanding they have a ref object somewhere that tracks time and that never gets freed... but that's within the domain of chronicles to deal with, I think |
23:12:08 | FromDiscord | <leorize> https://github.com/nim-lang/Nim/blob/c4f98b7696ce74c9952c973b0f09e59234f84917/lib/pure/times.nim#L1372 |
23:12:19 | FromDiscord | <leorize> threadvar strikes again |
23:12:42 | FromDiscord | <leorize> seems like nim threads are a leaky mess \:p |
23:13:00 | FromDiscord | <Phil> How the hell do you find these so fast |
23:13:15 | FromDiscord | <leorize> I followed the stack trace |
23:13:27 | FromDiscord | <Phil> Do you just go in with the notion that it'll be a treadvar somewhere? |
23:13:50 | FromDiscord | <leorize> it just happened to be a threadvar |
23:14:24 | FromDiscord | <leorize> the traces said `local -> newTimezone`, so I looked at those two and found that one |
23:14:27 | FromDiscord | <Phil> But localInstance is mentioned nowhere explicitly, the closest line is times.nim 1389 |
23:14:42 | FromDiscord | <Phil> Whiiiiich is an assignment to it... why does that look different for me locally |
23:15:16 | FromDiscord | <Phil> Because I was looking at the wrong line, uuuuugh |
23:15:42 | FromDiscord | <leorize> remember kids, turn on line numbers in your editor |
23:15:45 | FromDiscord | <Phil> by "looking at those two" you mean "Jump into file, ctrl+f the words?" |
23:15:53 | * | advesperacit quit () |
23:16:44 | FromDiscord | <leorize> the line numbers are in the trace |
23:16:53 | FromDiscord | <leorize> but for this instance, yes, I did ctrl+f |
23:17:22 | FromDiscord | <Phil> ... dang, localInstance actually is a problem |
23:17:32 | FromDiscord | <Phil> I can't nil them the way I did the dispatcher because they're private |
23:18:13 | FromDiscord | <Phil> And I don't think there's a setter for them |
23:18:44 | FromDiscord | <leorize> you might have to accept that your threads will leak simply because you're using nim |
23:19:44 | FromDiscord | <Phil> https://theuselessweb.site/nooooooooooooooo/โตPress the button |
23:20:18 | FromDiscord | <leorize> lol |
23:21:40 | FromDiscord | <leorize> here's a funny thing\: onThreadDestruction exists for registering thread cleanup handlers |
23:21:56 | FromDiscord | <leorize> but onThreadDestruction keeps its data in a threadvar seq |
23:22:04 | FromDiscord | <leorize> that is not destroyed on thread exit |
23:22:29 | FromDiscord | <Phil> The more I learn about this the more I want to bang my head against the wall |
23:23:13 | FromDiscord | <leorize> so it doesn't matter what you do, it will always leak |
23:24:48 | FromDiscord | <Elegantbeef> They're ran in reverse order so you could make the first proc be `=destroy(nimThreadDestructionHandlers)` |
23:25:33 | FromDiscord | <Elegantbeef> Which makes me wonder whether that's the intention |
23:26:00 | FromDiscord | <Elegantbeef> Atleast if I made it I'd have done first in first called |
23:26:30 | FromDiscord | <Elegantbeef> It being first in last called makes me imagine the reason is to register the first as the deallocator of all threadvars |
23:28:20 | FromDiscord | <leorize> or you could just... add `reset(nimThreadDestructionHandlers)` to the end of the threadProcWrapper |
23:30:50 | FromDiscord | <Phil> In reply to @Elegantbeef "They're ran in reverse": As in I could do that and it would do sth? What is nimDestructionHandlers? |
23:31:03 | FromDiscord | <leorize> we are talking about the stdlib impl |
23:31:09 | FromDiscord | <leorize> you can't do anything about this problem |
23:31:27 | FromDiscord | <Phil> ๐ซ ๐ฅ |
23:31:30 | FromDiscord | <Elegantbeef> I mean the variable is exposed |
23:31:42 | FromDiscord | <Elegantbeef> Can he not just add the proc call or reset call |
23:32:42 | FromDiscord | <leorize> yea but it only solve that particular variable |
23:32:58 | FromDiscord | <leorize> they still have to add one for every threadvar that might exist in the program |
23:33:58 | FromDiscord | <Elegantbeef> Ah right |
23:34:15 | FromDiscord | <Elegantbeef> Time to make a `{.realThreadVar.}` macro that does that ๐ |
23:34:22 | FromDiscord | <leorize> lol |
23:35:00 | FromDiscord | <Phil> I mean, at least for chronicles that is a general problem I have, I use chronicles internally as well, though I don't get why this leak only sometimes pops up |
23:35:28 | FromDiscord | <leorize> if you log anything that uses timezone and happens to be on an another thread, then it will pops up |
23:36:22 | FromDiscord | <Phil> I never specify timezones anywhere and logs do occur anywhere... I guess the log-level for chronicles just might've been too high and have compiled out the log occurrences that trigger it right now |
23:36:54 | FromDiscord | <leorize> chronicles just pull TZ whenever it logs the time it seems |
23:38:27 | FromDiscord | <Phil> I'm already setting up a `clearThreadVariables`to call at the end of the proc.โตTime to figure out how to do what beef mentioned |
23:38:47 | FromDiscord | <leorize> you modify the stdlib to add it \:p |
23:38:51 | FromDiscord | <Phil> I'd at least reset the 2 timezone variables |
23:38:59 | FromDiscord | <Phil> Wait that requires a stdlib change? |
23:38:59 | FromDiscord | <Phil> Shit |
23:39:19 | FromDiscord | <leorize> unless you can reach those private variables |
23:39:39 | FromDiscord | <Phil> In which case I could just nil'em directly |
23:39:40 | FromDiscord | <Elegantbeef> `import module {.all.}` enters the chat |
23:39:52 | FromDiscord | <Phil> Time to fuck up times day |
23:40:09 | FromDiscord | <leorize> this stuff is for modules to add support themselves |
23:41:37 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
23:42:02 | FromDiscord | <leorize> that should solve it for your examples at least |
23:42:04 | FromDiscord | <Phil> (edit) |
23:42:31 | FromDiscord | <Phil> And everyone using the lib. These instances will be spawned even through code used by me internally |
23:43:03 | FromDiscord | <Phil> It at least covers all threadvariables I use and fixes things to the best of my ability.โตThreadvariables that are introduced by others are impossible for me to deal with, but I can at least do the best I can in my domain |
23:43:11 | FromDiscord | <leorize> well rip\: https://github.com/nim-lang/Nim/blob/c4f98b7696ce74c9952c973b0f09e59234f84917/lib/system/orc.nim#L138 |
23:43:48 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
23:43:49 | FromDiscord | <Phil> ... the hell? |
23:44:33 | FromDiscord | <Phil> Time to nil roots I guess |
23:44:42 | FromDiscord | <Phil> Assuming that won't segfault |
23:44:52 | FromDiscord | <Phil> Which it likely will, but time to try! |
23:44:59 | FromDiscord | <leorize> https://github.com/nim-lang/Nim/blob/c4f98b7696ce74c9952c973b0f09e59234f84917/lib/pure/httpclient.nim#L378 |
23:45:03 | FromDiscord | <Elegantbeef> I do not know if `import system {.all.}` works |
23:45:11 | FromDiscord | <leorize> https://github.com/nim-lang/Nim/blob/c4f98b7696ce74c9952c973b0f09e59234f84917/lib/pure/logging.nim#L285 |
23:45:37 | FromDiscord | <Elegantbeef> You're probably just better off making threadvars automatically clean up ๐ |
23:46:15 | FromDiscord | <Phil> First I clean them up in my project, then I even remotely contemplate whether I start fixing this for the stdlib |
23:46:34 | FromDiscord | <Phil> Or at least I assume that's what you mean by "automatically clean up", that would be essentially providing a fix for the issue I raised, no? |
23:46:34 | * | Lord_Nightmare joined #nim |
23:46:38 | FromDiscord | <leorize> it's a compiler problem \:p |
23:46:39 | FromDiscord | <Elegantbeef> Well I imagine to do this properly it requires a bit of compiler work |
23:46:47 | FromDiscord | <Phil> Fuck |
23:47:03 | FromDiscord | <Elegantbeef> All global thread vars should be iterated over and have `=destroy` called on them |
23:47:12 | FromDiscord | <Phil> Err.... how do you even get to orc.nim |
23:47:16 | FromDiscord | <leorize> the tech to do this already exists |
23:47:19 | FromDiscord | <leorize> in nimskull at least \:p |
23:47:27 | FromDiscord | <Elegantbeef> `import system {.all.}` |
23:47:29 | FromDiscord | <Elegantbeef> If that even works |
23:48:30 | FromDiscord | <Phil> `type mismatch: got 'typeof(nil)' for 'nil' but expected 'CellSeq[system.Cell]'` snag dangit |
23:48:41 | FromDiscord | <leorize> just reset it lol |
23:49:39 | FromDiscord | <Phil> ... how? `roots = default(Cellseq[Cell])` ? |
23:50:02 | FromDiscord | <leorize> there's a proc called `reset` |
23:50:10 | FromDiscord | <leorize> that you call like this\: `reset(x)` |
23:50:14 | FromDiscord | <leorize> which destroys the variable |
23:50:33 | FromDiscord | <Elegantbeef> Bold of you to assume that `CellSeq[T]` has `=destroy` |
23:50:52 | FromDiscord | <Phil> ... shhhhhhhhhhhhhorts |
23:50:53 | FromDiscord | <leorize> lol it doesn't |
23:50:54 | FromDiscord | <Elegantbeef> You need to do `deinit(root)` |
23:51:10 | FromDiscord | <Phil> Yep, that did it |
23:51:45 | FromDiscord | <Phil> That is so many levels of messed up |
23:52:25 | FromDiscord | <Phil> However, now literally nothing leaks, not even flipping orc |
23:52:31 | FromDiscord | <leorize> I mean, you're doing threads in nim |
23:53:19 | FromDiscord | <Elegantbeef> In the end all top level `threadvars` need a `=destroy` implemented and called at the end of thread destruction |
23:53:36 | FromDiscord | <Elegantbeef> Which means that you need a closure per threadvar that is stored in a list |
23:54:23 | FromDiscord | <Phil> In reply to @leorize "I mean, you're doing": So? |
23:54:29 | FromDiscord | <leorize> ssl context will leak atm if you ever touch httpclient btw |
23:55:57 | FromDiscord | <Phil> Yeah but touching httpclient is user choice |
23:56:11 | FromDiscord | <leorize> didn't one of your example uses it? |
23:56:20 | FromDiscord | <Phil> Yeah but only the user-code of the example |
23:56:33 | FromDiscord | <Phil> times etc. are also used internally because I use chronicles internally |
23:56:38 | FromDiscord | <leorize> and you have a weird leak with that one, right? |
23:56:53 | FromDiscord | <leorize> although that one is full of futures so it could be just cycles |
23:57:09 | FromDiscord | <leorize> or closures not getting destroyed properly |
23:57:15 | FromDiscord | <leorize> I haven't check how closures functions |
23:57:42 | FromDiscord | <Phil> TFW loony doesn't implement peek so now I have to check whether I can |
23:58:28 | FromDiscord | <leorize> peek is pretty dangerous |
23:59:02 | FromDiscord | <Phil> I use it solely for logging so I guess I can live without it |
23:59:06 | FromDiscord | <Phil> Because turns out that no, no peek proc |