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