<< 20-05-2024 >>

00:00:07FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=GkWIqIrY
00:00:17*lucasta quit (Remote host closed the connection)
00:01:13FromDiscord<fenilli> but wouldn't that defeat the idea of have to redeclare twice the same enums?
00:01:32FromDiscord<Elegantbeef> I don't believe in non ordinal enums so you're asking the wrong person 😄
00:01:47FromDiscord<fenilli> well not that I like it either, just checking on a solution for it.
00:02:17FromDiscord<Elegantbeef> `const sizeToInt = [Small: 12, 20, 32]`↵`const sizeToInt array[AsteroidSize, int] = [12, 20, 32]`↵Also work
00:03:06FromDiscord<fenilli> well tbf I changed how it works so it doesn't really need to be a enum so well might as well use a single array of values at that point.
00:03:06FromDiscord<Elegantbeef> You can even do `[AsteroidSize.low: 12, ....]` 😄
00:05:31FromDiscord<fenilli> but tbf what I would expect from an non ord enum is to have a index and value, so when you iterate over it, you always iterate over index so you can do `ord(Enum[i])` to get value.
00:05:50FromDiscord<Elegantbeef> You can always implement that
00:06:07FromDiscord<fenilli> yeh i'm quite new to the language, so not sure how would I do that yet, probably will play around with macros later.
00:20:05*lucasta joined #nim
00:26:30FromDiscord<albassort> the most annoying thing about profiling thjis
00:26:33FromDiscord<albassort> (edit) "thjis" => "is"
00:26:52FromDiscord<albassort> getting it to quit properly
00:26:53FromDiscord<albassort> like i bound quit() to ctrlc and it wont exit because
00:27:28FromDiscord<albassort> (edit) removed "because"
00:27:33FromDiscord<albassort> it has and theres no prof
00:27:34FromDiscord<albassort> >:(
00:35:04FromDiscord<albassort> https://media.discordapp.net/attachments/371759389889003532/1241912037580214372/profile_results.txt?ex=664bec37&is=664a9ab7&hm=74ce9a2c8e3b06fef22a3195001e3f5ed12a7f4bad8e64e7e848c0afff5992bd&
00:35:06FromDiscord<albassort> here you go beef
00:35:50FromDiscord<Elegantbeef> What a shitty profiler
00:36:00FromDiscord<albassort> are you mad at me?
00:36:20FromDiscord<Elegantbeef> What profiler did you use?
00:36:22FromDiscord<albassort> i simply ran it for a while in real world situtations
00:36:27FromDiscord<albassort> nimprof
00:36:45FromDiscord<albassort> nim c -d:danger --stacktrace:on --profiler:on
00:36:49FromDiscord<Elegantbeef> Right use `--debugger:native -d:release` with hotspot
00:37:01FromDiscord<Elegantbeef> https://github.com/KDAB/hotspot
00:37:03FromDiscord<Elegantbeef> Or use valgrind
00:37:22FromDiscord<albassort> i dont like valgrind
00:37:24FromDiscord<albassort> i will try hotspot
00:37:41FromDiscord<Elegantbeef> hotspot a perf frontend
00:38:11FromDiscord<albassort> but beef, you didn't have any optimization ideas for the code i posted?
00:38:29FromDiscord<Elegantbeef> Don't know what valgrind did to you, but it's fantastic tooling
00:39:27FromDiscord<Elegantbeef> Stop reading 1 byte at a time removes means less IO waiting
00:39:37FromDiscord<Elegantbeef> Stop reading 1 byte at a time means less IO waiting
00:39:45FromDiscord<albassort> yes, that was the solution i was asking for...
00:39:53FromDiscord<albassort> i wanna read 1 mb at a time, and cut off if it runs out of data
00:39:58FromDiscord<Elegantbeef> But you said for certainty it was CPU time
00:40:12FromDiscord<Elegantbeef> > its cpu bound by around 15%
00:40:15FromDiscord<albassort> it is... yes, but they can go hand in hand if it takes cpu time to open it
00:49:57FromDiscord<albassort> ok beef so
00:50:05FromDiscord<albassort> it seems that asynccontinue takes up the most amount of time
00:50:27FromDiscord<albassort> which lines up with my theory that its cpu bound by being io bound and spamming the recv
00:50:36FromDiscord<albassort> so, do you have a better design for that?
00:51:20FromDiscord<Elegantbeef> Read the data to a buffer
00:51:38FromDiscord<albassort> but the buffer will halt if it runs out data
00:51:44FromDiscord<albassort> (edit) "buffer" => "operation"
00:52:01FromDiscord<albassort> and i also cannot know how much data was read
00:52:17FromDiscord<Elegantbeef> `recvInto` returns an int
00:52:56FromDiscord<albassort> not if interrupted
00:52:59FromDiscord<albassort> it returns 0
00:59:43FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=HuCSYGwM
00:59:47FromDiscord<albassort> like this just doesn't work
01:12:48*def- quit (Quit: -)
01:13:27*def- joined #nim
01:15:03FromDiscord<albassort> really the best way to implement this is for recv into to take in a pointer
01:15:03FromDiscord<albassort> and it is updated as data is read
01:18:19FromDiscord<fenilli> If I had a for loop where I check if any of the items in that are "primed" for deletion, how would I delete it, deleting directly there doesn't work as its mutating a seq.
01:18:29FromDiscord<fenilli> (edit) "If I had ... a" added "seq of items in"
01:18:44FromDiscord<Elegantbeef> Iterate the length backwards and delete
01:20:33FromDiscord<fenilli> after the first iteration or create another one?
01:20:44FromDiscord<fenilli> (edit) "create another" => "use the same"
01:25:38FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=cjctVODz
01:25:41FromDiscord<fenilli> sent a code paste, see https://play.nim-lang.org/#pasty=wpkFZDPU
01:25:53FromDiscord<fenilli> yeh I got to this point too
01:26:03FromDiscord<fenilli> thanks
01:26:33FromDiscord<Elegantbeef> Important distinction that using `del` can result in double `updateAsteroid`
01:27:10FromDiscord<fenilli> because it will mutate the asteroidSeq to that specific position correct?
01:27:27FromDiscord<fenilli> the head I mean
01:27:37FromDiscord<Elegantbeef> Actually it won't
01:27:40FromDiscord<Elegantbeef> I'm daft
01:27:54FromDiscord<fenilli> yeh it will just change the head and run the seq again so it should be fine no?
01:28:20FromDiscord<fenilli> because it is countdown so the head will always be the first to check
01:28:36FromDiscord<fenilli> or i'm drunk and not explaining but I get that it won't I think.
01:40:31*def- quit (Quit: -)
01:40:42*def- joined #nim
01:40:56FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=lzHVrEfo
01:41:15FromDiscord<albassort> this design seems to be about as fast as using recvInto and the difference between connecting directly is minable
01:41:22FromDiscord<albassort> threading now shall begin
01:41:50FromDiscord<albassort> (edit) "https://play.nim-lang.org/#pasty=oFaWQPlz" => "https://play.nim-lang.org/#pasty=CHzPLqjF"
01:43:59FromDiscord<m4ul3r> What would be the work flow of compiling nim from the generated cache?↵I am putting cache in the local dir, in the dir of `cache`, then wanting to make manual changes to the C file before recompiling
01:44:56*SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev)
01:45:18FromDiscord<m4ul3r> (edit) "recompiling" => "recompiling↵Obviously the first step is `nim c -c`"
01:51:27FromDiscord<albassort> i would really just fork the compiler or use the native C interop functions
01:51:28FromDiscord<albassort> like
01:51:51FromDiscord<albassort> i would sooner write a C function and call it in nim before adhoc modifying the generated c
01:51:56FromDiscord<albassort> sounds like a better use of my time
01:52:05FromDiscord<albassort> that is to say, this isn't a workflow I've heard of
01:54:45FromDiscord<grumblygibson> It can be informative for certain tasks to modify and compiles like that. You'll need `nimbase.h` from the compiler directory, or to reference it using include flags. Other than that the compilation should be straightforward.
01:54:56FromDiscord<grumblygibson> (edit) "compiles" => "compile"
01:56:34FromDiscord<albassort> its informative for debugging
01:56:36FromDiscord<albassort> but not for working
01:56:40FromDiscord<albassort> because its not meant to be human readable
01:56:47FromDiscord<albassort> (edit) "readable" => "readable, or mutatablle"
01:56:51FromDiscord<m4ul3r> My current solution is a python script that compiles and parses the json for the commands it used to compile and link. Then modify and run that - it works, but I'm really wondering if there's a compiler flag that compiles c the c from cache
01:58:36FromDiscord<Elegantbeef> `--genscript`
01:58:56FromDiscord<Elegantbeef> But the real question is .... why