<< 16-02-2016 >>

00:11:16*gokr quit (Ping timeout: 256 seconds)
00:13:48*yglukhov quit (Remote host closed the connection)
00:20:40*mat4 quit (Quit: Leaving)
00:24:03*Matthias247 quit (Quit: Matthias247)
00:30:41*Subspice quit (Remote host closed the connection)
00:48:27*NimBot joined #nim
01:16:47*pregressive joined #nim
01:17:24*darkf_ joined #nim
01:19:02*darkf quit (Ping timeout: 250 seconds)
01:20:20*filwit_ quit (Quit: Leaving)
01:20:32*darkf_ is now known as darkf
01:24:15*jaco60 quit (Ping timeout: 240 seconds)
01:32:12awsteelei'm trying to put a StringTableRef into the field of a JsonNode, but i think i might be missing something obvious
01:33:01awsteeleError: type mismatch: got (StringTableRef) but expected one of: json.%(keyVals: openarray[tuple[key: string, val: JsonNode]])
01:33:49awsteeleI assume that StringTableRef isn't implicitly convertible to the openarray of tuples that json.% expects, but is there an idiomatic way to do it? otherwise i loop over the string table and insert the nodes one by one
01:43:15def-awsteele: I guess that's the idiomatic way
01:43:41awsteeleHm, I was hoping there might be something involving sequtils.map or sequtils.toSeq
01:46:17*pregressive quit ()
01:47:37*pregressive joined #nim
01:53:30*pilne joined #nim
02:02:55*dorei joined #nim
02:04:29*vendethiel joined #nim
02:05:47*alexsystemf joined #nim
02:23:59doreiam i free to use whatever number of spaces i wish for indentation?
02:24:14def-dorei: 2 is recommended, 4 is pretty common as well
02:26:29doreithanx :)
02:26:54*vendethiel quit (Ping timeout: 272 seconds)
02:33:36*darkf_ joined #nim
02:34:15*darkf quit (Ping timeout: 260 seconds)
02:34:19*darkf_ is now known as darkf
02:54:32*apotheon quit (Ping timeout: 252 seconds)
02:57:06Varriountldlework: Any progress in reducing the number of string copies?
02:59:59*apotheon joined #nim
03:12:28VarriountAraq: What does the 'merge' pragma do?
03:14:16ldleworkVarriount: why can't I view source-code in kcachegrind?
03:14:30ldlework"This is because no debug information is present."
03:14:37ldleworkI'm not compiling with -d:release
03:14:39ldleworkso what gives
03:14:51Varriountldlework: No idea. Did you try '--debug:native'?
03:15:01*Druage joined #nim
03:15:20Druagehow would one copy a "string" into a "cstring"?
03:15:30Druagei tried using copyMem()
03:15:34ldleworkVarriount: to what? nim?
03:15:49Druagebut it expects a pointer to the source and destination string
03:15:54Druageand string in nim are gc'd
03:16:00Druageso i can't get the address
03:16:05Varriountdruage: Is the cstring from an outside source?
03:16:12VarriountDruage: Could you post your code?
03:16:18Varriountldlework: Yes.
03:16:26ldleworkVarriount: that's not a valid commandline option
03:16:34Druagei should explain myself more, but ill show ya a code example
03:16:51Varriountldlework: Woops, try '--debugger:native'
03:17:34ldleworkno luck
03:17:49Druagehttp://pastebin.com/zXf4BwjJ
03:17:51Varriountldlework: Hm. Let me see if I can get kcachegrind working on windows.
03:18:05Druage"Game" a custom type that i made
03:18:20Druagewhat im trying to do is the nim program is made into a dynlib
03:18:27Druageso it's loaded and run in c
03:18:44Druageim trying to display a cstring from nim into c
03:18:51VarriountDruage: Ah.
03:18:58Druagebut sometimes the gc kills my strings
03:19:07VarriountDruage: First off, are you allocating the cstring?
03:19:18Druagei am not yet
03:19:56Druageusing "alloc()" right?
03:20:40Druageif i do "var cstr: cstring = "Hello World" would this cause trouble?
03:20:59Druageim thinking it might
03:22:23VarriountDruage: Is the Game object a reference?
03:22:38VarriountEr, Game type a reference or an object type.
03:23:04Druageobject
03:23:33Druageheres the whole file http://pastebin.com/vV7gRnTc
03:24:25Druageline 48 is the copyMem
03:24:42Druageline 61 is where i assign values to the cstrings
03:24:47Druagenot sure if its valid though
03:24:57Druageim thinking i may be getting pointers to gc'd strings
03:25:02VarriountDruage: I'll go through it.
03:25:13Druagety
03:30:56VarriountDruage: Would the C code be allocating the game object?
03:31:01Druageno
03:31:22VarriountDruage: Would it be deallocating the game object?
03:31:26Druagen
03:31:28Druageno
03:31:43Druagehttp://pastebin.com/pBAEzuh7
03:31:49Druagethat's the main export file
03:31:53Druagethat wraps the game object
03:36:51*dorei quit ()
03:40:17ldleworkVarriount: it looks like I create a sequence for each tile on the map
03:40:27ldleworkwhich is just something I kinda have to do algorithmically
03:40:32ldleworkwonder how it could be optimized...
03:40:43Varriountldlework: Well, can you re-use the sequences at all?
03:41:00ldleworkVarriount: https://github.com/dustinlacewell/dadren/blob/master/dadren/generators.nim#L90
03:41:35VarriountDruage: I can show you a trick, if you don't mind slightly increased structure size.
03:41:50Druagedoesnt matter to me, im all for learning
03:42:01Druagehit me!
03:43:32*pilne loads up the bfg9k
03:45:05Druage:|
03:45:12Druageim scurred
03:52:29VarriountDruage: Sorry, just adding some explanation
03:52:35Druageits fine brother
03:52:35VarriountDruage: Plus doing other things
03:52:40Druagetrue that
03:53:50Druagei just moved to doing manual alloc calls
03:54:09ldleworkVarriount: wowwwww it goes so much faster now
03:54:21ldleworkbut now I get periodic 1-2 second pauses
03:54:27ldleworkgc cleanup?
03:55:11ldleworkI doubt kcachegrind is going to tell me where my gc deallocations are coming from
03:59:11*pregress_ joined #nim
03:59:11*pregressive quit (Read error: Connection reset by peer)
04:01:36VarriountDruage: https://gist.github.com/Varriount/3838821683215f516e98
04:01:47VarriountDruage: Sorry for the wait, I had to test to make sure I did things right.
04:01:59VarriountIt wouldn't be nice for me to give you a broken example.
04:02:18Varriountldlework: The GC is run on allocation.
04:02:27VarriountOr when the gc collection procedure is called.
04:02:34ldleworkVarriount: why would it get super busy ever few seconds
04:02:39ldleworkfor like more than a second
04:02:49Varriountldlework: You can specify realtime mode, that might help.
04:03:08Varriounthttp://nim-lang.org/docs/gc.html
04:04:02Varriountldlework: Again, profiling will help. I'm still trying to get kcachegrind up and running.
04:04:14DruageVarriount: the cstrings look like they aren't being copied though, seems like they're referencing a gc'd string
04:04:21VarriountDruage: Yep!
04:05:09VarriountDruage: The problem with using Nim strings directly in C is that a pointer to a Nim string is the length, then the capacity, then the string data.
04:05:38VarriountA nim cstring is essentially a ptr char
04:05:46Druageright its char *
04:06:09Varriountcstring(someNimString) is the same as `addr(someNimString[0])`
04:06:23Druagewouldnt this be the safest way? http://pastebin.com/E6zs5HJ9
04:06:29Druagewhere it copies over the chars
04:06:50*kulelu88 quit (Quit: Leaving)
04:07:08VarriountDruage: Yes, it is.
04:07:16Druagegothca
04:08:23Druageahh now it works!
04:08:23VarriountDruage: It's a tradeoff - if your strings are pretty much unchanging, and the Game object is going to deallocate the string objects anyway, why not let the GC do it for you?
04:08:46Druagewell
04:08:47VarriountWith that design, as soon as the Game object is collected, the strings will be collected too.
04:08:55Druagethats true
04:09:10Druagebut that also means i have to duplicate every cstring entry with a string
04:09:25VarriountDruage: You can also automate it with the `.` procedure
04:09:39Druagehmm
04:09:44Varriounthttp://nim-lang.org/docs/manual.html#special-operators-dot-operators
04:10:08Druagehmm
04:10:34Varriountldlework: It's odd that you're getting pauses when the number of allocations has decreased.
04:12:09VarriountDruage: What exactly do you want the C code to be able to do with the Game object?
04:12:31Druageim making targetting a game api
04:12:34Druageugh
04:12:43Druageim targeting a game api
04:12:49Druageso the c file will call
04:13:03Druageretro_run()
04:13:12Druageand it will spit out video game frames
04:13:14Druageand audio frames
04:13:29Druage1xframe per retro_run call
04:14:08Druageill pass c a raw array of video data
04:14:15Druagealong with an audio buffer
04:14:28Druagethe c program then displays it onscreen
04:15:15VarriountDruage: So is retro_load_game being passed a cstring?
04:15:26Druageit is now ya
04:15:48VarriountDruage: Is there a full API specification somewhere?
04:15:53Druageya
04:15:55ldleworkVarriount: Yeah the map generates pretty quickly now but I get large pauses periodically
04:16:00Druagehttps://github.com/libretro/RetroArch/blob/master/libretro.h
04:16:36Druageyou just output the raw data and the frontend handles displaying it and outputting it to speakers
04:16:39Varriountldlework: Odd. If you look at that link I posted, you can set the max pause time, which should help.
04:16:51ldleworkVarriount: I did that does not stop the pauses
04:17:21Varriountldlework: Then you must be allocating or deallocating a large chunk of data, or the cycle collector is kicking in.
04:17:37ldleworkVarriount: no luck setting up kcachegrind?
04:17:38Varriountldlework: What happens when disable the cycle collector?
04:17:42ldleworkhow?
04:17:57ldleworkah
04:18:53Varriountldlework: I'd rather compile from source. The only kcachegrind binary I can find is on sourceforge, and it's 3 years old.
04:20:44ldleworkdisabling mark and sweep doesn't prevent the hiccups
04:22:38Varriountldlework: Goodnes gracious, what is your program doing?
04:23:46ldleworkso disabling mark and sweep is bad since it just uses up all your memory lol
04:23:53Varriountldlework: You could try disabling the GC altogether, and see if the hiccups go away. That would at least indicate whether it's allocation or deallocation.
04:23:54Druageis there a resource to view what types nim comes with, such as all the int types
04:23:56ldleworkbut I guess my program does tons of allocations and deallocations
04:24:01Druagelike uintptr_t
04:24:05ldleworkbecause it uses up all of my memory very fast
04:24:10ldleworkif I scroll the map for about 2 minutes
04:24:13Varriounthttp://nim-lang.org/docs/system.html
04:24:14ldleworkI'm out of memory
04:24:22Druagety
04:24:34Varriountldlework: Wait, did you disable just the cycle detector, or the entire GC?
04:24:48ldleworkGC_setMaxPause(500)
04:24:49ldleworkGC_disableMarkAndSweep()
04:25:48ldleworkwhen the pause happens
04:25:53ldleworkmy whole computer is kinda frozen
04:25:57ldleworkcan't switch virtual windows, etc
04:27:12ldleworkI'm starting to think it is the way my mainloop is setup...
04:27:30Varriountldlework: What about when you disable the GC entirely?
04:28:12ldleworkVarriount: same behavior so I think something is happening to cause me to process many many many frames very fast in a single frame
04:28:17Varriountldlework: Ok, I think I got kcachegrind running.
04:28:19ldleworknice
04:28:25ldleworklet me commit
04:28:39Varriountldlework: Surprisingly, KDE has a windows installer.
04:28:52VarriountAnd it doesn't download yet another version of GCC/MinGW
04:29:31ldleworkVarriount: https://github.com/dustinlacewell/dadren
04:29:41ldleworkthere is a build.sh script in examples/hatchet
04:29:45ldleworkbut you'll need to adapt it to windows
04:29:50ldleworkI haven't learned nimscript yet
04:31:32ldleworkVarriount: I just pushed another commit
04:31:35Varriountldlework: Oh, wait. I just found out that valgrind isn't avialable for Windows...
04:31:38ldleworkto use a fixed timestamp
04:31:41ldleworkdoh
04:31:58VarriountI'll see if I can find a substitute
04:35:22ldleworkno joke but my computer makes a whining sound when I have the nim app up
04:36:01*endragor joined #nim
04:36:40ldleworkand when the pause in the program happens
04:36:45ldleworkthe whining sound in my laptop also pauses
04:37:26ldleworkand when it pauses
04:37:37ldleworkmy memory usage goes visibly up
04:37:52ldleworkwhat the hell could I be doing so wrongly
04:38:30Varriountldlework: You're allocating a 1GB array?
04:38:35ldleworkwhat
04:38:36ldlework?
04:38:41VarriountI dunno, I'm guessing.
04:38:48ldleworklol
04:38:50ldleworkjesus
04:38:52VarriountI found a profiler, from AMD of all things
04:40:26ldleworkI'm wondering how a profiler is gonna help
04:42:55*pilne quit (Quit: Quitting!)
04:43:15ldleworkVarriount: are you able to run the example?
04:43:24VarriountWorking on compiling it.
04:45:46Varriountldlework: Does this require anything besides the standard library?
04:46:13VarriountDruage: Everything alright?
04:46:40ldleworkVarriount: if clock
04:46:42ldleworkoops
04:46:52ldleworknimble install random csfml perlin sdl2
04:46:55ldleworknot csfml
04:47:14Druageya Varriount its all good in da hood
04:47:26Druagejust working on doing some more callbacks
04:52:57Varriountldlework: It's working!
04:53:46VarriountAnd I have the pause issues
04:55:15ldleworknice
04:56:35ldleworkone interesting thing I see is
04:56:40ldleworkwhen I ran the program for 20 frames
04:56:51ldleworkit shows yeah, the top level routine was called 20 times
04:56:59ldleworkbut the inner functions are called like 75k times
04:57:07ldleworkI know there are a lot of tiles on the screen
04:57:18ldleworkbut I wonder if its really that many or if we're rendering to many times sometimes
04:57:43ldleworkI just don't see any glaring logical errors where I would be, sometimes, rendering a few extra hundred times or whatever
04:58:30Varriountldlework: Are you sure the error isn't in a library you're calling?
04:58:48ldleworkVarriount: there is no error
04:58:55ldleworkand I have no idea what's causing the pauses at all
04:58:55VarriountWell, a problem then.
04:59:00ldleworkand if you have a resource viewer
04:59:04ldleworkyou will see each time it pauses
04:59:08ldleworkyour memory usage goes up visibly
04:59:36*darkf quit (Ping timeout: 250 seconds)
04:59:59*darkf joined #nim
05:03:05ldleworkokay I think my suspcions that I was rendering multiple frames is wrong
05:03:08ldleworkthe math checks out
05:03:20ldleworkI really am just rendering 79 * 44 tiles
05:03:37Varriountldlework: Are you deallocating parts of the map at all?
05:03:43ldleworkno
05:03:53ldleworkthat doesn't explain why memory usage goes up during pauses
05:04:05ldleworkmemory should go up linearly as you scroll right
05:04:08VarriountThe memory is doubling each time there's a pause, which points to some sort of resizing.
05:04:10ldleworknot magically all at once
05:04:14ldleworkinteresting
05:04:17VarriountAre you using a table?
05:04:18ldleworkVarriount: the table!
05:04:21ldleworkyes
05:04:28ldleworkthe map is broken into chunks
05:04:38ldleworkthe map is a table of (int int) to chunk
05:04:43ldleworkand a chunk is essentially its own table
05:04:44*darkf_ joined #nim
05:04:45*darkf quit (Ping timeout: 260 seconds)
05:04:48ldleworkfor (int, int)
05:04:52ldlework-> tile
05:05:30Varriountldlework: Well, you could try relegating allocation to a background thread.
05:05:59ldleworkOr do something more better than just unchecked table use?
05:06:17Varriountldlework: A linked list might work, at least for allocations.
05:06:25VarriountOr you could deallocate chunks.
05:06:28ldleworklike once there are N tables start deallocating the chunks that are furthest away
05:06:32ldleworkN chunks
05:06:34ldlework*
05:06:47Varriountldlework: Like every other infinite terrain based game.
05:06:49ldleworkVarriount: have you ever done any game programming?
05:07:09ldleworkVarriount: also can I make a bigger table ahead of time?
05:07:24Varriountldlework: The most I've done is programming for a completely custom server for minecraft.
05:07:59Varriountldlework: Again, you can try allocating the needed data in another thread, but there is still going to be contention.
05:08:26ldleworkVarriount: this game is turnbased and you'll never be zooming around generating content at this speed
05:08:31ldleworkhaha we're way over optimizing I think
05:08:45ldleworkbut I do need to deallocate based on range for sure
05:09:01ldleworkOr maybe keep another queue
05:09:13ldleworkwait no distance is the right way to go
05:09:29ldleworkVarriount: the generation is so fast now though :D
05:09:41Varriountldlework: Well, there's no public resize() method, however I'm sure that there's a private one.
05:10:00*darkf_ quit (Ping timeout: 260 seconds)
05:10:14Varriountldlework: See what happens when you realize strings are copy-on-assignment?
05:10:28ldleworkVarriount: I really appreciate you pushing me to look at it
05:10:55DruageVarriount: if you still have some time, how does one dereference a c ptr?
05:10:59VarriountDruage: You might want to take note of this fact: Strings and sequences are copy-on-assignment. The general rule is that the refcount to a string or sequence must always be 1
05:11:42Druagegotcha
05:11:50VarriountDruage: The semantics can be changed by marking the sequence or string with the shallow() procedure, however using it means that the string or sequence must not be modified.
05:12:10Druagecool
05:12:13Druagety
05:12:16VarriountEr, Strings or sequences marked with shallow() must not be modified.
05:12:58VarriountIf you need them modifiable, use a string or sequence reference.
05:13:20Varriountldlework: I still think that needs to be spelled in big, big letters somewhere.
05:13:36Druagei currently have a "pointer" so i casted that to the type i needed, but idk how to deref a "ptr" type and how to add data to it
05:14:16Druagelike in c "int *a = 12"
05:14:19VarriountDruage: the 'pointer' type is equivalent to a void pointer. You must cast it using `cast[TargetType](pointerValue)`
05:14:25Druagei know
05:14:31Druagei mean "ptr"
05:14:34Druagei already casted it
05:14:37VarriountTo dereference, use `[]`
05:14:44Druagelike
05:14:46Varriounteg, MyPointer[]
05:14:56DruageMyPointer[] = 32?
05:15:13VarriountOr `theInteger = pointerToInteger[]`
05:15:18*darkf joined #nim
05:15:51VarriountDruage: ^
05:16:01Druagewhat?
05:16:24VarriountSo, `myInteger = cast[ptr int](voidPointer)[]`
05:18:01Druagehttp://pastebin.com/b582Dfe1
05:18:09Druageyour saying like that?
05:19:18Druageassume i meant "ptr int" lol
05:19:22Druagei changed it
05:19:24VarriountDruage: Uh, that won't assign '5' to the pointer.
05:19:36Druageright
05:19:40Druageim not sure how to assign it
05:19:55Druageo
05:20:12Druagehm
05:20:18VarriountSame way, I think.
05:20:26Druage var fmt = ( cast[ptr int]( data ) )[]
05:20:29Druagethats how you do it
05:20:36Druagethen you can just do "fmt = 2"
05:20:56VarriountUh...
05:21:17Druageoh wait that copies it
05:22:01Druagewhy is to so confusing lol
05:22:29Druagevar fmt: ptr PixelFormat = cast[ptr PixelFormat]( data )
05:22:33Druagefmt[] = XRGB8888
05:22:34Druagethere
05:22:36Druagethat looks right
05:22:38VarriountYes.
05:22:46VarriountBe right back.
05:22:49Druagekk
05:23:06Druagei wish there was just a deref proc
05:23:07Druagelike
05:23:14Druagederef(fmt) = 2
05:23:33Druageor just stick with . operator
05:25:00*s4 joined #nim
05:32:28awsteeleis there a way to silence the nim compiler output when doing "nim c -r mynimfile.nim"? i am already doing 2>/dev/null, but it's still prepending "CC: stdlib_json" etc to the stdout
05:35:07awsteeleit seems the answer might be "--verbosity:0"
05:41:15Varriountback.
05:42:32VarriountDruage: The `()` and `.` operators will usually dereference automatically, though they might only do that for references.
05:42:45Druagei think its just for refs
05:43:20Varriounttemplate deref(x: untyped): untyped = x[]
05:43:30VarriountDruage: That might work.
05:43:54Druageill see
05:45:06VarriountDruage: Tell me if it works.
05:45:09Druagekk
05:47:29ldleworkhow is it possible that tables.items is not found? https://gist.github.com/dustinlacewell/d218425f1504faaddd93
05:47:33ldleworkits imported right at the top?
05:49:33ldleworktotally stumped
05:49:52DruageVarriount: it works
05:49:59Druagepretty cool
05:50:02Varriountldlework: Uh... Wow, that might be a bug.
05:50:05Druagelooks much better than [] operator
05:50:30ldlework:(((((
05:50:58VarriountDruage: If you want multi-dereferecing, you'll need to use a macro instead of a template (or just use `deref(deref())` )
05:51:09Varriountldlework: That might be a bug.
05:51:11Druagegotcha
05:51:17ldleworkyou said that :D
05:51:24VarriountOh.
05:52:13Varriountldlework: Hm. Have you tried a direct 'tables.items()'?
05:52:30ldleworkundeclared identifier: 'items'
05:52:36DruageVarriount: you can make it even hackier if you exchange "deref"
05:52:39Druagefor "*"
05:52:45Druagebrings me right back to c
05:52:46Druagelol
05:53:00VarriountDruage: http://nim-lang.org/docs/manual.html#iterators-and-the-for-statement-implict-items-pairs-invocations
05:53:03VarriountWoops
05:53:06Varriountldlework: http://nim-lang.org/docs/manual.html#iterators-and-the-for-statement-implict-items-pairs-invocations
05:53:18ldleworkVarriount: I did tables.items directly
05:53:24Druagelol
05:53:26Druagewas ganna say..
05:53:26VarriountDruage: That's asking for trouble with the compiler.
05:53:28Druageidk what that sfor
05:53:32DruageVarriount: i know lo
05:53:51ldleworkI did, from tables import items, Table
05:53:58ldleworkand got, Error: undeclared identifier: 'items'
05:54:00ldleworkon that line
05:54:02ldleworkwtfff
05:54:17Varriountldlework: I mean, doesn't the 'for' loop call items already?
05:54:40ldleworkVarriount: look at what I just said
05:55:01ldleworkimporting items from tables doesn't work
05:55:15ldleworklo
05:55:33ldleworkwhat could be happening I wonder
05:55:54ldleworkVarriount: oh right
05:56:01ldleworkfor tables its spelled `keys`
05:56:07Varriount-_-
05:56:09ldleworkthis isn't python :(
05:56:59ldleworkalso I do
05:57:00ldlework dy = pow((coord.y - pos.y), 2)
05:57:02ldleworkand get
05:57:07ldleworktype mismatch: got (int, int literal(2))
05:57:09ldleworklol what
05:58:11Varriountldlework: Is the target variable an int?
05:58:19ldleworkyes.
05:58:21Varriountpow() takes 2 floats, and returns a float.
05:58:24ldleworkso?
05:58:26*pregress_ quit (Remote host closed the connection)
05:58:28ldleworkthat's a horrible error message
05:58:34ldleworkis if the reason is that the target is an int
05:58:48ldleworkwhy would it suddently interpret the call as passing 3 ints
05:58:54ldleworkwhen that is just not even what it parses as
05:59:00Varriountldlework: Code and error message?
05:59:05ldleworkI just pasted
05:59:14ldleworkdy = pow((coord.y - pos.y), 2)
05:59:20ldleworktype mismatch: got (int, int literal(2))
05:59:27ldleworkoh it is
05:59:28ldleworkI see
05:59:31ldleworksorry
05:59:34ldleworkmisread
05:59:42ldleworkI injected another comma with my eye
06:01:20*lompik quit (Ping timeout: 260 seconds)
06:03:34Varriountldlework: I wonder if tables are the most efficient way... Well, since this is a turn based game, that shouldn't matter too much.
06:12:34*awsteele quit (Quit: My Mac has gone to sleep. ZZZzzz…)
06:14:52ldleworkVarriount: I'm del'ing from a table and somehow the items are not going away
06:15:02ldleworkmaking me think I'm copying my entire god damn tilemap somewhere
06:15:12ldleworkits a ref object though :(
06:16:59*Druage quit (Quit: Page closed)
06:17:20ldleworkVarriount: if my tilemap is a ref object and its field is a TableRef, then passing it doesn't copy it right?
06:18:27Varriountldlework: It shouldn't, not unless you're using deepcopy or something.
06:19:12ldleworkif I do
06:19:15ldlework camera.map.chunks = newTable[Point, Chunk]()
06:19:17ldleworkeverytime the camera moves
06:19:27ldleworkyou can see it regenerate a whole new world each time you move
06:19:34ldleworkbut the memory also goes through the roof
06:23:12VarriountWell, yes, because you're creating a new table.
06:23:35ldleworkyes but it should delete the old one
06:24:12VarriountTry calling the gc collection procedure and see if that does it.
06:54:51*yglukhov joined #nim
07:10:21*yglukhov quit (Remote host closed the connection)
07:38:22*Varriount quit (Disconnected by services)
07:38:23*Varriount_ joined #nim
07:42:06*federico3 quit (Ping timeout: 250 seconds)
07:44:31*ekarlso quit (Ping timeout: 276 seconds)
07:44:36*bbl_ quit (Ping timeout: 256 seconds)
07:45:05*federico3 joined #nim
07:45:10*Wildefyr quit (Ping timeout: 276 seconds)
07:46:12*bbl_ joined #nim
07:47:54*Wildefyr joined #nim
07:52:27*yglukhov joined #nim
07:59:07*ekarlso joined #nim
07:59:24*pregressive joined #nim
08:04:25*pregressive quit (Ping timeout: 260 seconds)
08:04:49*gokr joined #nim
08:07:32*wuehlmaus quit (Quit: Lost terminal)
08:12:58*Trustable joined #nim
08:15:58*gokr quit (Quit: Leaving.)
08:23:38*endragor quit (Remote host closed the connection)
08:39:40*endragor joined #nim
08:47:05*toaoMgeorge joined #nim
08:52:04*vendethiel joined #nim
08:54:34*gokr joined #nim
09:03:52*\u quit (Remote host closed the connection)
09:04:56*ray joined #nim
09:05:12*ray is now known as Guest8185
09:08:29*awsteele joined #nim
09:08:50*Guest8185 is now known as \u
09:08:57*filcuc joined #nim
09:09:02*\u quit (Changing host)
09:09:02*\u joined #nim
09:13:51*coffeepot joined #nim
09:16:53*coffeepot quit (Client Quit)
09:17:11*coffeepot joined #nim
09:18:12*coffeepot quit (Client Quit)
09:18:18*vendethiel quit (Ping timeout: 250 seconds)
09:18:34*coffeepot joined #nim
09:22:55*coffeepot quit (Client Quit)
09:23:14*coffeepot joined #nim
09:26:35*yglukhov quit (Remote host closed the connection)
09:37:54*yglukhov joined #nim
09:38:55*jaco60 joined #nim
09:40:29*endragor quit (Remote host closed the connection)
09:43:05*endragor joined #nim
09:46:21yglukhovAraq: --out and --nimcache cmdline options seem to be relative to input nim file. is this intended or a bug?
09:57:04*wuehlmaus joined #nim
09:58:10*darkf quit (Quit: Leaving)
09:58:58*awsteele quit (Quit: My Mac has gone to sleep. ZZZzzz…)
10:00:13*pregressive joined #nim
10:03:45wuehlmauswhat's the proc to test if a var is set: i thought that would be defined but the output is not what i thought it would be
10:04:33*pregressive quit (Ping timeout: 240 seconds)
10:09:28*Demon_Fox quit (Quit: Leaving)
10:10:00Araqyglukhov: intended
10:12:37flyxwuehlmaus: if you want to check if a var name is defined, you'd probably need to use "when compiles(varname):"
10:13:56flyxwuehlmaus: ah no, there is declared which does what you want
10:14:11wuehlmausflyx: oh, nice, thanks for the prompt answer
10:14:25wuehlmausthe more i know of nim the happier i get :)
10:14:33*x86128 joined #nim
10:14:53flyxI wonder why both defined and declared have magic: "Defined"
10:18:33Araqflyx: historical baggage. adding a new magic often causes bootstrapping problems
10:19:49flyxah okay
10:20:32yglukhovAraq: please see https://github.com/nim-lang/Nim/issues/3871. theres definitely a bug there.
10:21:07yglukhovalso "intended" doesnt sound like conventional and intuitive behavior ;)
10:24:02Araqso should it be relative to the current dir instead?
10:24:07yglukhovyup
10:24:11yglukhovor absolute
10:24:35yglukhovand as far i'm seeing from code outFile is going along with prependCurDir, which looks correct...
10:24:36Araqabsolute starts with /
10:24:41yglukhovyup
10:25:06Araqok, fix it then but check the status of the other "path handling" tagged bugs please
10:25:43Araqand document the change in news.txt
10:26:02Araqit's annoying people don't think about news.txt
10:26:43yglukhovalright
10:30:18*vendethiel joined #nim
10:31:26*jaco60 quit (Quit: Leaving)
10:37:19dom96Araq: Simply tell people to update news.txt when reviewing PRs
10:37:32Araqoften i do that, dom96
10:37:36Araqsometimes I forget it
10:38:26dom96yglukhov: I replied to that issue with a related bug. Would be awesome if you fixed it, especially since my book mentions the `-o` flag and explains that it works in the way you described.
10:39:02yglukhovyeah, i just also found that. ill try to fix it now.
10:48:16*arnetheduck joined #nim
10:52:56*vendethiel quit (Ping timeout: 272 seconds)
11:29:46*x86128 quit (Quit: Page closed)
11:31:28*gokr quit (Quit: Leaving.)
11:31:31*gokr1 joined #nim
11:36:21Varriount_ldlework: The table's deletion code seems to work fine.
11:38:07Varriount_ldlework: I wrote a quick simulation of what your program does (move a position around randomly, add chunks to the table in a range around the position, cull the rest)
11:38:21Varriount_ldlework: And I'm not seeing any abnormal memory usage.
11:48:26Varriount_Araq: What do you think of adding link time optimization to the default release build?
11:50:04Araqwhy isn't that already the default with -O3 ?
11:50:13AraqI thought it would be.
11:51:31Araqwe should also make profile guided optimization easier to use
11:53:41*vendethiel joined #nim
11:59:58def-Araq: Possible reasons: It's pretty new, so might be buggy, and takes a long time to compile, so should be considered closely
12:00:12def-from what I can tell compile time increases by a factor of 2 to 5
12:00:40Araqdef-: well it's a release build... seems acceptable
12:01:07*pregressive joined #nim
12:01:18def-I'd be interested how much it speeds up programs, I guess I should play around with it
12:05:50*pregressive quit (Ping timeout: 256 seconds)
12:08:02*desophos_ joined #nim
12:11:30*desophos quit (Ping timeout: 256 seconds)
12:22:00yglukhovAraq, dom96: fixed the issue with --out and --nimcache. Unfortunately other path handling issues have nothing in common with my issue.
12:23:46*spt joined #nim
12:24:49*desophos_ quit (Read error: Connection reset by peer)
12:27:16*filcuc quit (Ping timeout: 248 seconds)
12:28:28*tyu joined #nim
12:35:42*toaoMgeorge quit (Ping timeout: 252 seconds)
12:37:59*vendethiel quit (Ping timeout: 264 seconds)
12:39:08*vendethiel joined #nim
12:42:58*filcuc joined #nim
12:51:39*toaoMgeorge joined #nim
12:57:53*endragor quit (Remote host closed the connection)
12:58:22*endragor joined #nim
12:59:32*endragor quit (Read error: Connection reset by peer)
12:59:38*endragor_ joined #nim
13:02:23*vendethiel quit (Ping timeout: 276 seconds)
13:13:50*toaoMgeorge quit (Ping timeout: 252 seconds)
13:14:11*toaoMgeorge joined #nim
13:23:42*yglukhov_ joined #nim
13:23:42*yglukhov quit (Read error: Connection reset by peer)
13:30:01arnetheduckin the nim compiler, there are two for loop types used, for i in 1..x and for i in countup(1, x) - any reason to use the latter?
13:30:33arnetheduckor the former for that matter ;)
13:32:25Araqarnetheduck: no. the only reason the compiler uses countup() is that pas2nim generated it rather than '..'
13:32:33Araqand perhaps '..' came later
13:33:15arnetheduckah, ok.. been using .. but then I saw lots of countup, so thought there might be some advantage
13:34:09def-arnetheduck: countup can take a third parameter, the step
13:42:04*s4 quit (Quit: Konversation terminated!)
13:44:47Araqdef-: `..`(a, b, step) could work too
13:44:54Araqdunno if .. supports it.
13:45:07def-nope, it doesn't
13:48:05def-and how would you invoke it with 3 arguments except `..`(1, 100, step=2)?
14:02:01*pregressive joined #nim
14:06:43wuehlmausi think i saw 0..10..2 in another programming language
14:06:47*pregressive quit (Ping timeout: 264 seconds)
14:09:56*toaoMgeorge quit (Ping timeout: 256 seconds)
14:10:18*saml joined #nim
14:12:19*toaoMgeorge joined #nim
14:15:18def-wuehlmaus: 0,2..10 in Haskell, but I think countup is fine
14:16:15wuehlmausi am not well in haskell but i think it was not haskell where i found it
14:16:23Araqdef-: I would invoke it as you wrote. 0..10..3 would also be possible with the right set of overloaded stuff
14:19:16*vendethiel joined #nim
14:25:45wuehlmausharhar, i should have known it as i am a shell guy. zsh has it
14:26:22*endragor_ quit (Remote host closed the connection)
14:26:45wuehlmause.g. for i in {1..10..2}; { echo $i }
14:28:02*BitPuffin joined #nim
14:29:21gmpreussner_https://twitter.com/gmpreussner/status/699599283717349376
14:31:10coffeepotwow, nice work gmpreussner_
14:31:36coffeepottalk about quick on the case! :D
14:32:41*BitPuffin quit (Disconnected by services)
14:32:43*itPuffinB joined #nim
14:34:01*itPuffinB is now known as BitPuffin
14:36:20*nkr joined #nim
14:37:47*tyu quit (Quit: Connection closed for inactivity)
14:40:42*endragor joined #nim
14:40:47flyxnow I just need a driver that supports Vulkan
14:42:14*vendethiel quit (Ping timeout: 256 seconds)
14:44:59gmpreussner_coffeepot: yep, Nim should be the first language to have bindings (other than the C bindings shipping with the SDK) :)
14:45:16gmpreussner_flyx: driver links are on the Khronos website
14:45:41gmpreussner_all the major manufacturers will offer drivers. i'm using nVidia's right now.
14:45:53gmpreussner_Android should have built-in support, but i haven't tested it yet
14:46:17gmpreussner_haven't had time to test Linux either
14:46:32flyxis the API much different from OpenGL/OpenCL?
14:46:46gmpreussner_yes
14:46:57flyxnice
14:47:00*M-Quora quit (Remote host closed the connection)
14:47:03gmpreussner_much more low-level. it will take quite some effort to get started
14:47:06flyxanything that's different from OpenGL must be good
14:47:09gmpreussner_but you have to do it only once
14:47:30*askatasuna quit (Ping timeout: 250 seconds)
14:47:39flyxwhat about languages? are there still shading language / OpenCL C
14:47:42gmpreussner_the SDK sample to render a triangle is over 2000 lines of code ^^
14:47:51gmpreussner_they have SPIR-V now
14:47:56gmpreussner_which is an intermediate binary shader language
14:48:08gmpreussner_there will be compilers from other shading languages
14:48:25flyxso we can theoretically compile Nim to SPIR-V ^^
14:48:33gmpreussner_yes!
14:48:38gmpreussner_i already talked to araq about that
14:48:42flyxthat would be awesome
14:48:54gmpreussner_indeed
14:49:12flyxhas been a while since I've done graphics programming
14:49:29flyxkhronos website doesn't seem to be available
14:49:35gmpreussner_yeah, now is a good time to get started again
14:49:49gmpreussner_their site probably got overwhelmed
14:50:01flyxlast thing I did was writing an OpenGL/OpenCL wrapper for Ada
14:50:49*M-max joined #nim
14:54:31*lompik joined #nim
14:56:58flyxapparently, there hasn't been any confirmation that Apple will support Vulkan :/
14:59:16coffeepotgmpreussner_ I didn't realise you were on the Epic team. It's fantastic to hear that Nim has industry game programmer supporters :)
14:59:56gmpreussner_flyx: i doubt they will anytime soon. they're pushing Metal.
14:59:57coffeepotI only play gamedev atm but it's something I've always followed, and to me it definitely makes sense as a game writing language
15:00:10gmpreussner_coffeepot: yeah, Nim is awesome. keeps me sane.
15:00:43flyxgmpreussner_: thought so. well then Vulkan doesn't seen an alternative for me
15:03:05gmpreussner_i think they will have no choice but to support it eventually
15:03:14gmpreussner_Vulkan runs pretty much everywhere else already
15:03:50gmpreussner_Windows + Android + Linux + Tizen.... that in itself is pretty cool
15:04:09gmpreussner_it covers a huge market. in a year from now, nobody is gonna use Metal, i think :)
15:04:41flyxsince Apple is a Khronos Promoter, I also think that they will adopt it eventually
15:08:30gmpreussner_i think both Metal (only Apple) and DirectX12 (only Windows 10) are doomed
15:08:54gmpreussner_especially since all three are very similar, and Vulkan tries to improve on both
15:09:52flyxI don't have any insight in the gaming industry, but don't most developers rely on a few rendering engines, which support multiple backends (OpenGL/DirectX/...) anyway?
15:30:31*M-Quora joined #nim
15:32:27*M-max quit (Quit: node-irc says goodbye)
15:34:28nsflol, guys you are quick
15:34:31nsfhttps://github.com/nimious/vulkan
15:44:31*pregressive joined #nim
15:44:36*pregressive quit (Remote host closed the connection)
15:44:43wuehlmausAraq: how would i define a 1..10..2 range operator?
15:45:10wuehlmaus1..10..2 as an example , of course
15:45:18*pregressive joined #nim
15:48:17*jaco60 joined #nim
15:48:56reactormonkwuehlmaus, with functions? make ..2 return a function etc.
15:49:14reactormonkbasically take a look how nim compiles it via dumpTree
15:49:24reactormonkOr a template/macro.
15:49:33reactormonk... and rewrite it to something you can handle.
15:52:09wuehlmausreactormonk: yes, that's an area i did not study 'til now. i know about templates, but macros not so much. i knew about dumptree
15:55:18*M-Quora quit (Remote host closed the connection)
16:01:01*M-max joined #nim
16:03:23*gokr1 quit (Quit: Leaving.)
16:05:41def-wuehlmaus: even easier, 1..10 can be a slice
16:07:40def-wuehlmaus: so something like this (untested, look at system.nim's countup for how to do it properly): https://gist.github.com/def-/4ec0e315f6d74e64688b
16:13:31*spt quit (Quit: Page closed)
16:14:38*M-max quit (Remote host closed the connection)
16:18:27*M-max joined #nim
16:18:40wuehlmausdef-: very nice
16:18:47*shodan45 joined #nim
16:18:52wuehlmausnim is so cool, i am amazed every time :)
16:21:55shodan45yeah, but where is v1.0? ;)
16:22:04shodan45kotlin just went 1.0
16:22:22shodan45sadly it primarily targets the JVM
16:23:24shodan45maybe nim needs a corporate backer? :)
16:30:33*Demos joined #nim
16:34:16*vendethiel joined #nim
16:42:01Araqshodan45: throwing money at me wouldn't hurt
16:42:33*arnetheduck quit (Ping timeout: 240 seconds)
16:43:20*yglukhov_ quit (Remote host closed the connection)
16:45:02*yglukhov joined #nim
16:48:04jsudlowHi @ll, does anyone know where to put .dll files that are used in nim programs on 64bit windows? I guess I'm trying to figure out the default search path nim uses when its looking for .dll's on windows 7 64 bit
16:48:32def-jsudlow: same directory as the exe should work
16:48:43def-I think that's what's commonly done on Windows.
16:49:27def-Generally it should be the same as for C programs, don't think Nim changes anything there (but not sure)
16:50:28AraqNim doesn't change anything here. it's OS dependent
16:50:38jsudlowthanks def, I was just trying to get SDL2_ttf.dll to load
16:52:21*M-max quit (Remote host closed the connection)
16:52:34jsudlowwhen I place the .dll inthe directors it still wont load it, the last time I had this kind of issue it was beacuse i was using 32 bit .dll's with a 64 bit system
16:53:26jsudlowbut I got the 64 bit in there, so if it still wont load maybe somethings wrong with the actual .dll still
16:53:59def-Or you're compiling 32 bit Nim programs instead
16:55:31jsudlowoh I'm a doofus.... I was using the run time binaries instead of the development ones
16:55:54*vendethiel quit (Ping timeout: 250 seconds)
16:56:10jsudlowwhen you put it next to the exe it works! thanks def
17:04:09*vendethiel joined #nim
17:06:31jsudlowyou guys may not know this but if I have a surfacePtr in sdl2 does anyone know how to get the actual surface that the surfacePtr points too?
17:08:01*Arrrr joined #nim
17:08:10AraqsurfacePtr.nativeHandle or something similiar
17:08:42*Demos quit (Read error: Connection reset by peer)
17:19:43*coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
17:27:58*vendethiel quit (Ping timeout: 250 seconds)
17:29:59*vendethiel joined #nim
17:38:58*shodan45 quit (Quit: Konversation terminated!)
17:42:17yglukhovAraq: any thoughts about my prs? #3873, #3870, #3863
17:45:46*Demon_Fox joined #nim
17:52:14*vendethiel quit (Ping timeout: 250 seconds)
17:54:32*brson joined #nim
17:57:45*toddpratt joined #nim
18:00:21*filcuc quit (Read error: Connection reset by peer)
18:06:48*pilne joined #nim
18:09:24ArrrrThat was fast https://github.com/nimious/vulkan
18:25:31*yglukhov quit (Remote host closed the connection)
18:31:54*Demon_Fox quit (Quit: Leaving)
18:40:17*vendethiel joined #nim
19:01:08*BitPuffin quit (Ping timeout: 250 seconds)
19:05:07wuehlmausAraq: do you think that 1..10..2 functionality could be in system.nim? i think it's just cool.
19:06:08ldleworkwhat does it do?
19:06:13ldlework1 to 10 by two?
19:06:27ldleworkor 1 to 10 back down to 2?
19:07:01wuehlmaus1 3 5 7 9
19:07:54wuehlmausldlework: it's that way in the zsh shell.
19:08:12*darkf joined #nim
19:12:20Araqwuehlmaus: I think it's not required and system.nim should not be bloated any further
19:14:23ldleworkgmpreussner_: Why don't the bindings work on linux?
19:16:36*Jesin quit (Quit: Leaving)
19:26:03*yglukhov joined #nim
19:27:54*Jesin joined #nim
19:30:09*yglukhov quit (Ping timeout: 240 seconds)
19:31:21*yglukhov joined #nim
19:35:19flyxso I actually managed to release v0.1.0 of my YAML implementation: http://flyx.github.io/NimYAML/index.html
19:38:19ArrrrJust when i was looking for one, good work flyx
19:43:16flyxArrrr: it's not the first one, theduke released one back in december when I was just writing my parser
19:44:04ArrrrI had no idea, is it on nimble?
19:44:16flyxmine currently lacks a document object model (which is planned for future releases), but it's good at serializing native Nim types
19:45:50endragorCan I make Nim not to generate NimMain-related variables and procedures (NimMain, NimMainInner, cmdLine, etc.)? --noMain option makes it not generate C main procedure, but it still generates other stuff.
19:46:36flyxArrrr: yeah, here: https://github.com/nim-appkit/yaml
19:48:06flyxArrrr: he had a different focus and parses YAML into a values true (another one of his projects)
19:48:20flyx*tree
20:12:06*awsteele joined #nim
20:17:07*endragor_ joined #nim
20:19:26*endragor_ quit (Read error: Connection reset by peer)
20:19:33*endrago__ joined #nim
20:20:32*endragor quit (Ping timeout: 256 seconds)
20:21:23*Arrrr quit (Read error: Connection reset by peer)
20:28:52*endrago__ quit (Ping timeout: 248 seconds)
20:30:57*def- quit (Ping timeout: 240 seconds)
20:33:47*def- joined #nim
20:56:01*gokr joined #nim
20:57:51*shodan45 joined #nim
20:59:55*Varriount joined #nim
21:01:59*yglukhov quit (Read error: Connection reset by peer)
21:02:58*Varriount_ quit (Ping timeout: 240 seconds)
21:03:00*yglukhov joined #nim
21:04:52*Varriount quit (Disconnected by services)
21:04:52*Varriount_ joined #nim
21:08:24*Varriount joined #nim
21:10:24*Varriount_ quit (Ping timeout: 256 seconds)
21:11:01*Varriount quit (Disconnected by services)
21:11:01*Varriount_ joined #nim
21:17:25*BitPuffin joined #nim
21:19:08ldleworkIf anyone is interested I'm looking to pay someone for a handful of hours to audit my nim code base for memory in efficiencies and long held references.
21:19:46*BitPuffin quit (Remote host closed the connection)
21:22:23ldleworkPM me for details if you are interested
21:32:48*yglukhov quit (Remote host closed the connection)
21:47:28*Trustable quit (Remote host closed the connection)
21:54:00ldleworkNo offers hm.
21:56:11def-ldlework: I wrote a PM
21:57:19ldleworkdef-: my bouncer swallowed it :(
21:57:38ldleworkoh its on my phone
21:58:59*mat4 joined #nim
21:59:02mat4hello
22:06:23*shodan45 quit (Read error: Connection reset by peer)
22:06:39*shodan45 joined #nim
22:09:42ldleworkhi mat4
22:09:51mat4hi ldlework
22:09:51ldleworkor servus as is tradition
22:10:47ldleworkservus is ironic in english
22:10:57ldleworksince it says "serve us" but means a projection of servitude.
22:11:31mat4hmm ok, it's a common greeting in southern Germany and Austria
22:12:16mat4(from Latin 'salve')
22:21:15mat4which means in English 'greeting'
22:23:21*vendethiel quit (Ping timeout: 240 seconds)
22:33:19*yglukhov joined #nim
22:37:21*yglukhov quit (Ping timeout: 240 seconds)
22:39:41*Matthias247 joined #nim
22:40:13ldleworkis there an efficient way to remove all items from a Table without reallocating it
22:40:30*vendethiel joined #nim
22:46:06*Varriount_ is now known as Varriount
22:46:56mat4use a hash stack
22:54:49Varriountldlework: Still having table allocation problems?
22:55:18VarriountToo bad we can't generate an object graph. Or can we?
22:55:53ldleworkVarriount: def- | nono, don't start playing around with the GC, we can remove all allocations
22:55:59ldleworkto which I replied
22:56:02ldleworkO_O
22:56:22*Subspice joined #nim
22:56:24Varriount:|
22:56:32VarriountHi Subspice
22:56:37SubspiceHello :)
22:56:39ldleworkVarriount: why the sadface
22:57:10Varriountldlework: Not sad, just surprised. Well, maybe a bit sad that I'm not smart enough to think of a way to remove all allocations.
22:57:48VarriountDid def- mean all allocations in the entire program, or just the ones with map chunks?
22:58:00ldleworkI think just in this specific billow generator
22:58:12ldleworkand I think he pulled it off because I'm scrolling with no pauses and my ram isn't going up
22:58:33VarriountI don't suppose I could have a look at the code?
22:58:34def-Varriount: writing nim without heap memory allocs is fun too, but no, just in one closure
22:58:37*mat4 left #nim ("Leaving")
22:59:10*pregressive quit (Remote host closed the connection)
22:59:56ldleworkdef-: so basically you just coupled the generator to the noise value and then since you already sorted it, you don't even need to search you just accessed it in the tuple
23:00:42def-i guess. i just changed the code to do the same thing as before without allocations without thinking much about it
23:01:05ldleworklol
23:01:08ldleworkjerk
23:01:56*vendethiel quit (Ping timeout: 248 seconds)
23:03:28shodan45I think I'm going to write my first nim program for actual use: an old fashioned "form mail" CGI program :)
23:03:58ldleworklol
23:04:12ldleworkreimplement the opengl api ontop of vulcan
23:05:06*pregressive joined #nim
23:05:37shodan45I have a huge CMS (plone) running a virtually unused site... going to try converting it to static html, but it does have a contact-us form
23:05:56asdfgmpreussner_, hmm, i think the vulkan bindings do work on linux; i only tried the lunarG sdk's "instance" sample and it seems to work; i'll be happy to try running some code that actually does something, if you have any
23:06:18asdfgmpreussner_, (FWIW here's the 'instance' sample in nim i used https://bpaste.net/show/6cdbedd7e9f1 )
23:11:29*filwit joined #nim
23:15:17*pregressive quit (Remote host closed the connection)
23:20:15*vendethiel joined #nim