00:01:17 | rayman22201 | sooo.... If I copy the string by doing `let msg = $message` at the top of the function, It works fine for me. |
00:02:00 | FromGitter | <timotheecour> well ya, but his followup qq was how to do zero-copy, which is a legitimate qq |
00:02:32 | rayman22201 | He told me about an hour ago, that he was ok with copying |
00:03:04 | FromGitter | <timotheecour> Lol, i know; and then he said this: https://gitter.im/nim-lang/Nim?at=5c4a4d8920b78635b679b701 |
00:03:14 | FromGitter | <timotheecour> either way, it’s a legitimate qq |
00:05:04 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
00:05:12 | FromGitter | <timotheecour> in past 1 thing that worked for me for some application was to provide a callback to C: `callForeignFun(myAllocate, args)` which would allocate a nim string on nim’s GC and pass `s[0].addr` when the C function needed to allocate |
00:05:15 | rayman22201 | lol. wat. @iffy, you are giving us mixed messages. What do you want? copies or no? |
00:05:17 | rayman22201 | https://irclogs.nim-lang.org/24-01-2019.html#22:22:56 |
00:06:28 | FromGitter | <iffy> rayman22201: I want that repo to run without error; if I have to use copies, great. If I don't, great. I have tried all kinds of things -- some of which involved making copies, some which didn't. |
00:07:00 | FromGitter | <iffy> In the end, I don't care *how* it's done, I just want that Javascript code to send a string to nim, have nim append something and send it back. |
00:07:17 | FromGitter | <timotheecour> its trivial if u’re ok w copies. |
00:07:36 | rayman22201 | @timotheecour, will s[0].addr still work? I thought nim strings no longer have null terminator. I guess I am unsure of the nim string memory layout. |
00:07:43 | FromGitter | <deech> With the latest Nim pulled from `devel` when I have the following in `nim.cfg`: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c4a534f8ce4bb25b805e085] |
00:08:07 | FromGitter | <iffy> @timotheecour how do you do it with copies? |
00:08:41 | FromGitter | <timotheecour> if u receive a cstring from a foreign call, just call `$mycstring` |
00:08:51 | FromGitter | <iffy> And then how do I return a string? |
00:08:51 | rayman22201 | @iffy let msg = $message |
00:09:35 | FromGitter | <timotheecour> in the other direction: if u send a cstring from nim to foreign, just make sure the nim string outlives the use of it by the foreign code, and u’ll be fine |
00:09:42 | rayman22201 | @iffy see my post above: sooo.... If I copy the string by doing `let msg = $message` at the top of the function, It works fine for me. |
00:10:17 | FromGitter | <iffy> So you'd change this: https://github.com/iffy/node-nim-memory-bug/blob/master/clib.nim |
00:10:19 | FromGitter | <iffy> to |
00:10:22 | rayman22201 | just do result = &"{msg} bla blah" |
00:10:29 | FromGitter | <iffy> like ^ |
00:10:48 | rayman22201 | yup |
00:10:56 | FromGitter | <iffy> That's the code that doesn't work :) |
00:11:11 | FromGitter | <iffy> It has a memory leak or some other memory problem |
00:11:23 | FromGitter | <timotheecour> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c4a542b7a0f4d5b190233c3] |
00:11:25 | rayman22201 | yeah, you are missing the $message |
00:11:48 | FromGitter | <iffy> @timotheecour I want to return the string, not call another function |
00:12:27 | FromGitter | <timotheecour> return from nim to foreign code? |
00:12:31 | FromGitter | <iffy> yes |
00:12:45 | FromGitter | <iffy> @timotheecour here's what I have right now: https://github.com/iffy/node-nim-memory-bug/blob/master/clib.nim |
00:12:46 | FromGitter | <timotheecour> how is that not a call |
00:13:10 | rayman22201 | ah, the echo makes it crash for me. |
00:13:20 | FromGitter | <timotheecour> like i said : u need to make sure it outlives its use in foreign code |
00:13:36 | FromGitter | <iffy> That's what I'm asking how to do |
00:13:37 | FromGitter | <timotheecour> just keep a global variable that holds a ref to it to avoid GC collecting it |
00:13:58 | rayman22201 | This works for me: https://pastebin.com/raw/dBkJ3YZu |
00:14:07 | rayman22201 | when I uncomment the echo, it breaks. |
00:14:20 | FromGitter | <iffy> breaks with a gcAssert? |
00:14:27 | rayman22201 | yup |
00:15:04 | FromGitter | <kaushalmodi> This looks similar to the issue I had the other day. |
00:15:19 | FromGitter | <kaushalmodi> The solution was to use gc:none or regions |
00:16:14 | FromGitter | <kaushalmodi> There too, the echo caused the crash |
00:16:25 | FromGitter | <timotheecour> many ways to do it ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c4a5559cb47ec3000994657] |
00:16:37 | FromGitter | <timotheecour> i dont’ think u need gc:none |
00:16:51 | FromGitter | <timotheecour> *var s = “”` |
00:16:53 | FromGitter | <kaushalmodi> Search for `withScratch` in irc logs 2 days back. |
00:17:29 | rayman22201 | @timotheecour, you are missing the issue here. Which I think is that something is interacting strangely with echo + gc when called from foreign code |
00:17:38 | FromGitter | <iffy> rayman22201: okay, I'm seeing the same thing as you (commenting out echo, program runs to completion). But GC_getStatistics makes me think that there's still a memory leak |
00:18:05 | rayman22201 | or that the gc is just broken somehow in this context. |
00:18:09 | FromGitter | <iffy> [GC] total memory: 17305600 ⏎ [GC] occupied memory: 1365608 |
00:18:19 | rayman22201 | in general, the GC does not work well when called as a library |
00:18:35 | FromGitter | <iffy> okay, so regions might be a better option as @kaushalmodi suggests? |
00:18:39 | FromGitter | <timotheecour> @iffy im very happy to help if u can reduce to a tiny case involving 1 nim file + 1 C file |
00:19:01 | FromGitter | <iffy> @timotheecour I can't figure out the g++ incantation, but this is what I have so far: |
00:19:49 | FromGitter | <timotheecour> (use github gists maybe :) ) |
00:20:04 | FromGitter | <iffy> @timotheecour https://gist.github.com/iffy/c0e5e962bf3f14acf41dc6969f322747 |
00:21:20 | * | leorize joined #nim |
00:21:48 | FromGitter | <iffy> I'm sure I've got something wrong with references/pointers, but maybe you get the gist of it |
00:25:21 | FromGitter | <timotheecour> Thx for reducing it; indeed it had nothign to do w node :) |
00:25:38 | FromGitter | <iffy> That's good to hear! |
00:27:04 | rayman22201 | please enlighten use @timotheecour? |
00:27:10 | FromGitter | <iffy> just my luck, you're going to get hit by a bus right now |
00:28:10 | FromGitter | <timotheecour> lol no i meant: since u’ve reduced it to just nim+C, it proves my gut feeling that it had nothing to do w node :) |
00:28:24 | FromGitter | <iffy> well, I haven't been able to run it yet |
00:28:30 | rayman22201 | He didn't though. He isn't able to compile it, so he doesn't know it that is the issue |
00:28:32 | FromGitter | <iffy> so I don't know if it has the same problem |
00:28:38 | FromGitter | <timotheecour> oh |
00:28:55 | FromGitter | <iffy> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c4a58471cb70a372a319ec3] |
00:29:02 | FromGitter | <kaushalmodi> That was an emotional roller coaster :P |
00:29:31 | FromGitter | <timotheecour> btw do u care whether the main driver is C ? can it be nim? |
00:29:54 | FromGitter | <iffy> ummm... as long as it helps me eventually fix the problem when I run it with Node, no :) |
00:30:31 | rayman22201 | If I change it to not use the `result` in the echo it works, but it still shows an uncomfortable amount of memory growth: https://pastebin.com/raw/TKzmrVL8 |
00:30:33 | FromGitter | <iffy> so maybe, as a first step "no" but as a second step "yes" |
00:30:46 | FromGitter | <iffy> rayman22201: that's what I'm seeing, too |
00:30:54 | FromGitter | <iffy> I feel like there should be almost no memory growth |
00:31:13 | rayman22201 | I'm guessing there is something inside of echo that is causing the gc to be unable to free some memory |
00:31:36 | FromGitter | <iffy> but the memory goes up even without echo, no? |
00:32:17 | rayman22201 | I haven't checked. |
00:32:33 | FromGitter | <iffy> it does for me |
00:32:49 | leorize | have you tried to call the GC collector manually? |
00:32:51 | FromGitter | <iffy> although I guess I'm echoing GC_getStatistics |
00:33:15 | FromGitter | <iffy> leorize: I tried in some attempt and I think it still had the gcAssert problem. I'll try again |
00:33:22 | rayman22201 | @leorize, i was thinking the same thing |
00:33:32 | FromGitter | <iffy> leorize: GC_fullCollect()? |
00:33:51 | leorize | yep |
00:33:59 | * | FromGitter * iffy tries it |
00:34:42 | rayman22201 | as interesting as this is, I wonder if gc:regions will just be way easier to deal with |
00:35:13 | FromGitter | <iffy> I'm willing to try it; but I need to go soon so I'll try it tomorrow |
00:35:55 | rayman22201 | I'm trying it now |
00:36:41 | leorize | gc:regions docs is really bad atm |
00:36:51 | rayman22201 | true unfortunately |
00:36:57 | rayman22201 | Araq keeps promising a blog post |
00:37:03 | FromGitter | <iffy> Do they exist? |
00:37:10 | rayman22201 | not really |
00:40:09 | FromGitter | <iffy> Calling `GC_fullCollect()` at the end of each `hello_echo` and not echoing result allows the program to finish. The memory growth seems excessive, but I guess it works: |
00:40:13 | FromGitter | <iffy> [GC] total memory: 3674112 ⏎ [GC] occupied memory: 61528 |
00:40:16 | FromGitter | <iffy> leorize: ^ |
00:40:47 | leorize | have you tried the different GCs? |
00:41:20 | FromGitter | <iffy> I tried --gc:stack I think? but it complained about something undefined |
00:41:42 | leorize | Have you tried --gc:markAndSweep? |
00:41:45 | FromGitter | <iffy> Araq also suggested I try regions, but I don't know how to do that. @kaushalmodi pointed me toward something from a day or two ago, though |
00:41:53 | FromGitter | <iffy> lemme try that |
00:41:58 | leorize | stack is an alias for regions |
00:42:07 | rayman22201 | I'm trying to find some example for regions |
00:42:34 | rayman22201 | Testing with gc_fullcollect, has better memory growth, but still bad |
00:42:59 | FromGitter | <iffy> rayman22201: I confirm; mine got to 3MB total (though occupied was low) |
00:43:09 | leorize | iirc the GC only collects when you allocate |
00:43:16 | FromGitter | <iffy> But in an Electron app, what's 3MB :) |
00:43:29 | skellock | shots fired |
00:43:29 | rayman22201 | I get 5.7 MB |
00:43:34 | rayman22201 | it's bad |
00:44:03 | rayman22201 | especially when I started with half a meg. no good at all |
00:44:05 | FromGitter | <iffy> leorize: markAndSweep finishes but with a lot of growth: |
00:44:06 | FromGitter | <iffy> [GC] total memory: 24055808 ⏎ [GC] occupied memory: 2552280 |
00:44:34 | FromGitter | <iffy> (that was without echoing result) |
00:44:53 | rayman22201 | https://github.com/nim-lang/Nim/blob/devel/tests/gc/thavlak.nim |
00:45:10 | rayman22201 | example from the source |
00:45:27 | rayman22201 | search for `withScratchRegion` |
00:45:45 | FromGitter | <iffy> okay, sadly I have to go; Thank you everyone for your help! I'll keep plugging away (next is regions) |
00:46:02 | rayman22201 | 👍 gn |
00:49:48 | leorize | Araq: how do you think about adding token length to LineInfo? |
00:51:25 | leorize | I get the idea from prettybase, but it'd be more efficient to implement it directly into the parser |
00:54:44 | FromGitter | <timotheecour> @iffy |
00:54:56 | FromGitter | <timotheecour> i just managed to compile the standalone C++ + nim code |
00:55:07 | FromGitter | <timotheecour> there is no mem leak it seems |
00:55:24 | FromGitter | <timotheecour> running for 1000 iterations shows mem usage going up and down, not up |
00:58:48 | FromGitter | <timotheecour> using the simplest options: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c4a5f488ce4bb25b8062c52] |
01:03:58 | rayman22201 | there is a mem leak, it's just not there |
01:04:13 | rayman22201 | the node example obviously leaks. |
01:09:36 | rayman22201 | with gc:regions it grows to 732Kb and stays there. that's pretty decent. |
01:12:13 | rayman22201 | also side note, this thing is compiling nim in debug mode, so super not optimized code. |
01:17:25 | leorize | how about --gc:destructors? |
01:17:57 | rayman22201 | I don't think destructor strings have been merged yet, so idk if it will work |
01:18:08 | leorize | it's merged and hello world is working |
01:18:19 | rayman22201 | oh, ok. Then I will try it |
01:18:26 | leorize | it won't work when threads is involved though |
01:19:01 | rayman22201 | The regions output is interesting, because the memory stays at 16k for a long time and suddenly jumps. I'm trying to figure out why |
01:20:36 | rayman22201 | Is cross thread destructors still wip? |
01:25:09 | * | leorize quit (Ping timeout: 256 seconds) |
01:27:09 | * | leorize joined #nim |
01:29:31 | rayman22201 | `gc:destructors` won't even compile. `../lib/system/excpt.nim(224, 5) Error: internal error: '=sink' operator is generic` |
01:30:07 | rayman22201 | that's using #head. I pulled and rebuilt just to make sure. |
01:30:42 | leorize | does "hello, world!" work? |
01:31:48 | rayman22201 | no |
01:32:11 | rayman22201 | all programs I try fail |
01:32:23 | rayman22201 | do I need new c sources? |
01:32:30 | rayman22201 | I wouldn't think so... |
01:32:59 | leorize | I guess it has a regression |
01:33:12 | leorize | you should open a new issue |
01:33:19 | leorize | use the Hello, world example |
01:33:38 | rayman22201 | bleh. ok |
01:34:04 | rayman22201 | way off from where we started lol |
01:37:54 | leorize | lol |
01:38:21 | rayman22201 | bah. pulling the latest seems to break gc:regions as well |
01:38:29 | rayman22201 | everything has gone to hell |
01:39:05 | rayman22201 | https://www.irccloud.com/pastebin/eul9AZot/ |
01:48:41 | rayman22201 | How is this happening... /me runs the gc test suite... gc:regions and gc:destructors is never tested.... :/ |
01:49:14 | leorize | those are fairly experimental features |
01:50:37 | rayman22201 | fair enough. But how are you supposed to know if they regress if they aren't regularly tested? |
01:51:04 | * | abm quit (Ping timeout: 272 seconds) |
01:52:15 | * | zachk quit (Quit: Leaving) |
01:52:42 | rayman22201 | weird. Thavlak.nim runs fine with gc:regions... |
01:55:03 | * | zachcarter quit (Ping timeout: 245 seconds) |
01:58:44 | * | skellock quit (Quit: WeeChat 2.3) |
02:01:49 | * | darithorn quit (Quit: Leaving) |
02:06:59 | * | darithorn joined #nim |
02:11:00 | * | Tyresc quit (Quit: WeeChat 2.4-dev) |
02:17:15 | rayman22201 | the node thing works fine when I define a region explicitly, but `withScratchRegion` gives an illegal storage access. the default tlRegion is a threadLocal var, so I wonder if it has something to do with @iffy's node-gyp thing passing the wrong flags to the C compiler (since that is what appears to be driving the compilation in his case.) |
02:18:47 | rayman22201 | anyway. I have to take off. I will brb later. I will push my changes to your code as a pr @iffy to show you how it works with regions. I will make a bug report for gc:destructors as well I guess... ttyl |
02:19:35 | rayman22201 | There is still memory growth in there that I'm not sure where is coming from, but anyway. bye... |
02:30:53 | * | Geezus42 quit (Quit: WeeChat 2.3) |
02:47:57 | * | zachcarter joined #nim |
02:52:25 | * | zachcarter quit (Ping timeout: 246 seconds) |
02:53:16 | * | darithorn quit (Ping timeout: 250 seconds) |
02:56:48 | * | darithorn joined #nim |
03:02:07 | * | banc quit (Quit: Bye) |
03:12:21 | * | Marumto joined #nim |
03:14:47 | * | Marumoto quit (Ping timeout: 240 seconds) |
03:17:24 | * | dddddd quit (Remote host closed the connection) |
03:22:59 | * | banc joined #nim |
03:40:40 | * | oculux joined #nim |
03:49:21 | * | zachcarter joined #nim |
03:53:48 | * | zachcarter quit (Ping timeout: 245 seconds) |
04:07:21 | * | nsf joined #nim |
04:39:05 | FromGitter | <iffy> @timotheecour I'll have to try using --app:lib, but I'm seeing memory growth with this version: https://gist.github.com/iffy/7ad0755869240ebe295b1306179b7042 (And thanks for the clang++ example) |
04:43:11 | FromGitter | <iffy> @rayman22201 thanks for all your debugging |
05:03:41 | FromGitter | <iffy> @timotheecour I think I might be too tired to figure out why this compilation doesn't work (when attempting --app:lib): https://gist.github.com/iffy/789a2788b0e585f8c380867616847555 |
05:11:03 | * | leorize quit (Remote host closed the connection) |
05:23:15 | FromGitter | <iffy> @leorize markAndSweep works on all my stuff (all the way into the Electron app) even though it still seems to leak |
05:50:13 | * | zachcarter joined #nim |
05:52:41 | * | narimiran joined #nim |
05:57:26 | * | zachcarter quit (Ping timeout: 250 seconds) |
06:03:34 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
06:05:19 | * | darithorn quit (Quit: Leaving) |
06:48:28 | * | zachcarter joined #nim |
06:53:10 | * | lritter joined #nim |
06:58:58 | * | krux02 joined #nim |
07:25:15 | FromGitter | <gogolxdong> import karax / [jstrutils, kajax, vdom, karaxdsl, karax, kdom, kbase, jjson] ⏎ ⏎ proc navigateTo*(e:Event, n:VNode) = ⏎ ⏎ ```result = buildHtml(tdiv()): ⏎ button(onclick = navigateTo): text "submit"``` ... [https://gitter.im/nim-lang/Nim?at=5c4ab9dbdab15872ceec0f45] |
07:25:39 | FromGitter | <gogolxdong> Uncaught DOMException: Failed to execute 'pushState' on 'History': A history state object with URL 'file:///D:/lxd/nimtest/karax/navigateTo.html' cannot be created in a document with origin 'null' and URL 'file:///D:/lxd/nimtest/karax/hello.html'. ⏎ ⏎ ```at file:///D:/lxd/nimtest/karax/nimcache/hello.js:715:16``` [https://gitter.im/nim-lang/Nim?at=5c4ab9f2c45b986d11b75c6d] |
07:32:44 | FromGitter | <gogolxdong> sorry, should run with http server. |
07:38:24 | * | leorize joined #nim |
07:53:12 | * | powerbit quit (Read error: Connection reset by peer) |
08:14:09 | FromGitter | <bung87> anyone can review my code ?https://github.com/bung87/proxy/blob/master/src/proxy.nim#L19 |
08:14:17 | FromGitter | <bung87> I got |
08:14:22 | FromGitter | <bung87> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c4ac55eba355012a494c5ab] |
08:14:59 | FromGitter | <bung87> when I refresh the browser quickly |
08:26:46 | * | vonHabsi joined #nim |
08:26:57 | FromGitter | <2vg> > `Too many open files` ⏎ maybe, file descriptor limit. ⏎ ref: https://docs.oracle.com/cd/E19623-01/820-6168/file-descriptor-requirements.html |
08:28:29 | FromGitter | <bung87> I just checked it right now ,it’s unlimited |
08:30:03 | FromGitter | <bung87> even per request a socket ,almost 100 request one page load |
08:31:22 | FromGitter | <gogolxdong> cat /proc/sys/fs/file-max ⏎ sysctl -w fs.nr_open=`cat /proc/sys/fs/nr_open` ⏎ vim /etc/security/limits.conf ⏎ *soft nofile your value ⏎ *hard nofile your value [https://gitter.im/nim-lang/Nim?at=5c4ac95ac45b986d11b7c020] |
08:31:45 | FromGitter | <gogolxdong> you cannot set it to unlimited |
08:32:39 | FromGitter | <gogolxdong> it's ambiguous and harmful |
08:32:51 | FromGitter | <bung87> I dont think problem is there. |
08:33:01 | FromGitter | <gogolxdong> ```vim /etc/security/limits.conf ⏎ *soft nofile 1048576 ⏎ *hard nofile 1048576``` [https://gitter.im/nim-lang/Nim?at=5c4ac9bd0721b912a5d64afa] |
08:33:33 | FromGitter | <gogolxdong> have you restart your machine with `unlimited` value? |
08:34:12 | FromGitter | <bung87> it’s just a proxy server, I just refresh a page, can not be that much |
08:37:17 | FromGitter | <gogolxdong> you probably cannot login if you set it to unlimited after restarting. |
08:37:23 | * | floppydh joined #nim |
08:38:36 | FromGitter | <bung87> no ,I ‘m on my MBP,it’s unlimited when I check it |
08:40:26 | * | absolutejam joined #nim |
08:41:41 | FromGitter | <gogolxdong> What's MBP |
08:41:52 | FromGitter | <bung87> mac book pro |
08:42:04 | FromGitter | <gogolxdong> cool |
08:43:14 | FromGitter | <gogolxdong> I encountered this problem once on Linux server, then I reinstalled the system. |
08:45:31 | FromGitter | <bung87> it happens when you server runs on public |
08:46:04 | absolutejam | anyone know if there's a way to pass arbitrary data with an argparse parser/subparser? |
08:46:09 | absolutejam | Wrong channel, mb |
08:47:31 | FromGitter | <gogolxdong> true. |
08:52:11 | FromGitter | <gogolxdong> BTW, the API of Tencent isn't consistent with IETF RFC 2616, which says Http header field name is case-insensitive, I have feedback to them, they committed the fault and will fix this issue. |
08:52:52 | FromGitter | <bung87> sounds cool! |
08:54:32 | FromGitter | <gogolxdong> haha, Tencent brought many issues, more than others. |
09:05:26 | * | abm joined #nim |
09:13:58 | * | ng0 joined #nim |
09:15:37 | * | krux02 quit (Remote host closed the connection) |
09:18:43 | * | ng0 quit (Client Quit) |
09:35:56 | * | PMunch joined #nim |
09:40:36 | * | zachcarter quit (Ping timeout: 250 seconds) |
09:40:51 | * | JustASlacker joined #nim |
09:40:54 | JustASlacker | hello |
09:41:02 | JustASlacker | sorry for the newbie question |
09:41:15 | JustASlacker | but I get fatal error: limits.h: No such file or directory |
09:42:01 | JustASlacker | when trying to compile a helloworld.nim |
09:42:18 | PMunch | You probably need to install linux-headers |
09:42:28 | PMunch | Should be in your package manager :) |
09:42:57 | JustASlacker | dpkg -l | grep linux-headers |
09:42:57 | JustASlacker | ii linux-headers-4.15.0-20 |
09:43:13 | Zevv | if you're ubuntu/debian based, try 'apt-get install build-essential' |
09:43:49 | JustASlacker | ah, that was it |
09:43:51 | JustASlacker | thanks |
09:44:28 | PMunch | Yeah, it various a bit from distro to distro where they pack these things :P |
09:44:34 | * | JustASlacker nods |
09:44:57 | PMunch | I held my "Metaprogramming in Nim" talk yesterday at the university. As sort of a test run for FOSDEM |
09:44:58 | JustASlacker | I did that probably hundreds of times already but I still get confused |
09:45:06 | PMunch | It went well, and I think I got some people interested |
09:46:35 | narimiran | PMunch: give us more info :) did you manage to do it in that limited time? what background did audience have? etc |
09:47:30 | PMunch | Yeah it was 15 minutes and some odd seconds :) The audience was our student group for computer science studies, but they range from 1st year to doctorates |
09:48:26 | * | vonHabsi quit (Ping timeout: 240 seconds) |
09:49:04 | PMunch | It's a fairly general overview, I just talk a bit about how it works and they show some examples. I plan on writing a companion blog post if people wants to get deeper into it :) |
09:49:20 | narimiran | good idea about blog post! |
09:50:42 | PMunch | Yeah I thought that would be nice if people wanted some more information, and it's a nice way to expand the talk :) |
09:54:34 | PMunch | I'm a bit afraid however that it will be very similar to this: hookrace.net/blog/introduction-to-metaprogramming-in-nim/ |
09:55:10 | narimiran | PMunch: and now you have to compete with this too :) https://nim-lang.github.io/Nim/tut3.html |
09:55:40 | PMunch | Ooh, there's a part III now? |
09:55:50 | narimiran | :) |
10:24:57 | * | Vladar joined #nim |
10:28:28 | * | nsf quit (Quit: WeeChat 2.3) |
10:30:27 | * | Perkol joined #nim |
10:30:43 | Perkol | Why do I get an error:https://bpaste.net/show/74c28554c000 |
10:31:02 | narimiran | Perkol: because of `@[int]` |
10:31:22 | Perkol | How do iproperly declare seq of ints? |
10:31:37 | PMunch | var temp: seq[int] |
10:31:38 | narimiran | in line 4 do `...): seq[int] =` |
10:31:46 | narimiran | and you don't have to use `temp` |
10:32:03 | PMunch | As of 0.19.0 you don't have to initialize sequences, just declare them :) |
10:32:12 | narimiran | PMunch: and he can use `result` |
10:32:15 | PMunch | But yeah, you should use result |
10:32:54 | PMunch | Change your procedure definition to this: `proc stringToIntArray(input_string: string): seq[int]` |
10:33:14 | Perkol | I did same error |
10:33:22 | PMunch | Then drop the temp variable and the return statement and do `result.add(ord(i))` |
10:33:27 | narimiran | Perkol: ok, wait i'll make a whole example |
10:34:15 | narimiran | Perkol: here you go: v |
10:34:16 | narimiran | http://ix.io/1zbX/ |
10:34:55 | PMunch | http://ix.io/1zbY/ |
10:35:01 | narimiran | but it would be nicer to do `for c in input_string: result.add(ord(c))` |
10:35:20 | narimiran | ...as PMunch just showed :) |
10:35:25 | PMunch | :) |
10:36:12 | narimiran | and you can just do: `echo "test".mapIt(ord(it))` :) |
10:36:44 | Zevv | TIL mapIt, thanks |
10:38:10 | narimiran | Zevv: sequtils has more of those, take a look (especially now that somebody improved its docs :P) https://nim-lang.github.io/Nim/sequtils.html#18 |
10:38:19 | Perkol | Resut supported in nim 0.18? |
10:38:45 | Zevv | yeah, I think I read all the manuals top to bottom at least once, but there's always stuff you just forget after reading because it doesn't properly sink in when you read it |
10:38:55 | narimiran | Perkol: you need to do `result = newSeq[int]()` at the beginning of your function in 0.18. but switch to 0.19, for your own sake ;) |
10:39:14 | narimiran | Perkol: read this https://narimiran.github.io/nim-basics/#_result_variable |
10:39:23 | Zevv | The docs should be flipped inside out in a way, I want to search all things doing 'something with seq[T]' for example |
10:39:28 | PMunch | Yeah pre 0.19.0 you needed to initialize sequences, otherwise they would be a nil ref |
10:39:55 | Perkol | Yeah, thanks |
10:39:58 | PMunch | Zevv, I was looking into creating a more dynamic docs system |
10:40:02 | narimiran | Zevv: https://nim-lang.github.io/Nim/theindex.html ;) |
10:40:38 | PMunch | Basically use jsondoc and ingest that into a database. Then create some proper search things, add a comment section (similar to Clojure documentation), etc. |
10:41:47 | FromGitter | <timotheecour> @iffy @rayman22201 regarding memory growth problem (or lack thereof ) see https://github.com/timotheecour/vitanim/commit/e5c8de5e218771f59f66a4afc306ddc1a902093f#commitcomment-32064117 with a test case showing no memory growth |
10:42:04 | Zevv | How/where is 'theindex' generated? Would it make sense to include the first sentence (up to the first ., or the first n characters) after each item in that list? |
10:42:33 | Zevv | first sentence of the ## doc, that is |
10:42:55 | PMunch | Rather grab the first N characters and add an ellipse |
10:43:04 | PMunch | Makes more sense IMO |
10:43:06 | FromGitter | <timotheecour> u can do a quick search for it right? it’s easy to find where it’s generated |
10:43:22 | narimiran | Zevv: eh, now suddenly "I want to search all things doing 'something with seq[T]'" is not enough? :P :D |
10:43:28 | Zevv | It's never enough |
10:46:55 | Araq | I still think jsondoc is wrong, it's a document in a tree structure. you know what captures this tree structure? HTML. |
10:48:52 | PMunch | Araq, benefit of jsondoc is that it's easier to ingest into tooling |
10:49:00 | PMunch | HTML is more painful to parse |
10:51:55 | PMunch | Plus someone might want to change the HTML for visual purposes, the jsondoc should in theory be more stable |
10:54:54 | Zevv | What are the highest-level memory management primitives, preferrably portable, that I can use to make sure memory is returned to the OS when I no longer use it? |
10:55:27 | Zevv | I have a long living process that occasionally needs to handle large chunks of tens of mbs |
10:55:27 | FromGitter | <timotheecour> Yup, jsondoc is definitely the right approach, makes tooling easier, html can just load it (i’ve explained somewhere else how u can do it serverless) |
10:55:58 | FromGitter | <timotheecour> (side benefit, would make theindex.html faster to load since json is more compact than the expanded html) |
10:56:05 | Zevv | I make sure to prealloc the string large enough so that there is one mmap() happening under the hood, but nim will not munmap() the block by default if I later lose references to the new string |
10:56:44 | FromGitter | <timotheecour> would also enable dynamically adjusting content more easily (eg hiding/showing private docs (cf —docInternal) etc |
10:57:45 | FromGitter | <timotheecour> but tooling is the main argument here |
10:58:09 | PMunch | Zevv, if you use a string it should be GCed whenever you loose references to it.. |
10:58:20 | Zevv | Yeah, but GC'ing is done at the nim-level |
10:58:43 | Zevv | nim aquires more memory from the os when needed, for example using brk() or mmap() on linux |
10:59:08 | PMunch | timotheecour, my idea was to ingest the JSON into a database on the server. This would mean that it would serve up HTML just like it does now. |
10:59:10 | Zevv | and I see that in the memory management there are ways to return it to the OS, but I don't see this happening in my tests |
11:00:15 | PMunch | Try to put a gc full collect in your test |
11:01:15 | Zevv | I did |
11:01:27 | PMunch | Can I see the test? |
11:01:42 | Zevv | http://paste.debian.net/1062432/ |
11:01:49 | Zevv | run with nim c t.nim && strace -emmap,brk,munmap ./t |
11:02:03 | Zevv | type '1' to trigger an alloc. string of 10M goes in to local var 'a' |
11:02:13 | Zevv | type '0' to leave scope of the proc and force a GC |
11:02:39 | Zevv | observe the mmap() reported by strace, and the lack of unmap() which I hoped for |
11:03:47 | Perkol | Why is result preferable to return? |
11:04:19 | * | krux02 joined #nim |
11:04:26 | Zevv | it's likely that nim has other stuff in that mmap()ed block which is still in use of course |
11:04:36 | narimiran | Perkol: because it is already there, and it is idiomatic in nim, compared to your `var temp` which can be anything |
11:05:11 | FromGitter | <timotheecour> @pmunch so long there’s an intermediate jsondoc file the rest is implementation detail (although implementation i would prefer would generate the html via js as i described, enabling dynamic docs, eg filters) |
11:06:30 | FromGitter | <timotheecour> @perkol : @araq also mentioned RVO as a speed benefit of `result` over `return` although i never saw the proof of that claim :) |
11:06:41 | FromGitter | <timotheecour> 1) NRVO |
11:07:28 | Zevv | Named Return Value Optimization (yes, I had to look that up) |
11:07:36 | PMunch | Zevv, I only see one mmap for the first 1 I type |
11:07:38 | narimiran | @timotheecour do you think those acronyms are useful for somebody who has problems with declaring an empty seq? (even i don't know what you mean) |
11:07:41 | PMunch | So there is some more going on here |
11:08:07 | FromGitter | <timotheecour> Its a google click away :) |
11:08:26 | narimiran | it's noise |
11:08:43 | Zevv | PMunch: yes, that is expected. The first alloc needs mem, so Nim goes to the OS to ask for memory. When you leave 'flop()', the var is collected but the memory arena is still kept by Nim. The next type you enter flop(), a new alloc is not needed because the arena is already big enough |
11:09:02 | FromGitter | <timotheecour> no it’’s not. It actually may be the biggest benefit of `result` over `return`, if true. |
11:09:36 | PMunch | Perkol, basically when you use result it will write it directly into the memory region of your calling procedure, saving you a memory copy |
11:09:38 | narimiran | TDMASFABIN |
11:09:42 | * | dom96_w joined #nim |
11:09:53 | narimiran | AEFUME |
11:10:10 | narimiran | JGI |
11:10:14 | PMunch | Perkol, plus it looks nice |
11:10:54 | narimiran | DYGMP? |
11:16:56 | Araq | timotheecour: The biggest benefit is that 'return' is unstructured control flow and to be avoided |
11:17:38 | Araq | if n != nil: echo n[] # easy to prove safe, the condition dominates the subtree |
11:17:44 | Araq | if n == nil: return |
11:17:59 | Araq | echo n[] # much harder algorithms required to prove the same |
11:20:27 | FromGitter | <timotheecour> araq there’s 1 type of scenario where `result` is being abused in nim repo and return would lead invariably to cleaner code: the cases where using `return` would keep nesting to a minimum whereas `result` would lead to deep nested code (aka hard to prove/reason about , for humans) |
11:20:32 | * | Perkol quit (Remote host closed the connection) |
11:21:03 | FromGitter | <timotheecour> typically a pipeline of early returns |
11:21:18 | Araq | no, that's wrong |
11:21:36 | Araq | "keep nesting to a minimum" is exactly unstructured programming |
11:22:00 | Zevv | -> "for humans" |
11:22:48 | Araq | if you dislike "nesting" then it's not clear why we ever tried to minimize the number of gotos |
11:22:53 | FromGitter | <timotheecour> @araq i’m talking about this: https://softwareengineering.stackexchange.com/a/18473/257920 |
11:23:08 | Araq | yeah, it's all wrong. |
11:23:49 | FromGitter | <timotheecour> Ok can u elaborate or, preferably, give a link where i can read more about this? |
11:25:12 | Araq | https://www.cs.cmu.edu/~aldrich/courses/654-sp07/slides/7-hoare.pdf |
11:27:02 | FromGitter | <timotheecour> thx for the link, will read; when u say `easy to prove` and reason about, do u mean the reader of the code or for static analysis by the compiler |
11:27:32 | Zevv | you are talking different things - human stack size for understanding is severly limited |
11:28:10 | Araq | if you have the tooling and the tooling only works with nesting then you're better off with the nesting, whether it suits your "human stack" or not |
11:28:47 | Zevv | I'd always trust the tooling ;) |
11:29:28 | Araq | btw I've seen human being argue for the non-nesting because they reason about the code like a compiler does it. |
11:30:12 | Araq | er, typo |
11:30:18 | Araq | argue for the *nesting* |
11:30:34 | FromGitter | <timotheecour> i mean if it’s provably better for tooling I’d accept that as an argument, but objectively most normally constituted humans would prefer the small nesting |
11:30:48 | Zevv | "normally constituted" :) |
11:31:06 | Araq | while cond: body # after the loop 'not cond' holds |
11:31:21 | Araq | while cond: body with a break in it # after the loop who knows what holds. |
11:34:04 | FromGitter | <timotheecour> not convinced; early return means: u can guarantee the returned value won’t change after it’s returned; whereas with `result`, who knows whether value may change down the line. |
11:35:12 | FromGitter | <timotheecour> and you’re talking about a different thing here: `break`in a while loop, whereas i’m talking about return vs result |
11:36:26 | Araq | it's the same thing, both cause a "divergence" in control flow |
11:37:07 | Araq | it's so bad that you love a 'defer' statement to fix the mess you created |
11:37:36 | Araq | because without it, you cannot do 'echo result' at the proc end reliably |
11:37:48 | FromGitter | <timotheecour> I have to disagree. And I think you’re a small minority here regarding `defer` |
11:37:52 | Araq | or add some profiling code |
11:38:15 | Araq | or if you like to add acquire/release for locking |
11:39:45 | FromGitter | <timotheecour> defer leads to safer code/less bugs ; this: `open(foo); bar(); close(foo)` is potentially incorrect; the correct alternative to defer (try/finally) is quickly unreadable after a few levels of nesting, causing ppl to just not even use it and use the incorrect version. |
11:40:18 | FromGitter | <timotheecour> that’s one of the things D got right. |
11:41:08 | Araq | you can disagree all you want but I'm not reading a single argument beyond "I dislike nesting" |
11:41:54 | FromGitter | <timotheecour> I did: ⏎ ⏎ > u can guarantee the returned value won’t change after it’s returned; whereas with result, who knows whether value may change down the line. |
11:42:48 | Araq | that argues for 'result should have 'let' semantics', totally different topic IMO |
11:43:10 | FromGitter | <timotheecour> `result.add` is a pattern, widely used |
11:43:32 | FromGitter | <timotheecour> can’t have the cake and eat it to |
11:43:34 | FromGitter | <timotheecour> *too |
11:44:32 | Araq | still no arguments for return. |
11:44:48 | Araq | proc foo(): int = 4 # no return, no result, best of all worlds? |
11:45:46 | FromGitter | <timotheecour> We’re talkign about this: https://softwareengineering.stackexchange.com/questions/18454/should-i-return-from-a-function-early-or-use-an-if-statement/18473#18473 |
11:46:13 | FromGitter | <timotheecour> not this `proc foo(): int = 4` (no-one complains about that) |
11:47:04 | FromGitter | <kaushalmodi> +1 on the jsondoc! |
11:47:07 | Araq | yeah, I know, software engineers are not engineers, do not know anything about math and dislike nesting. |
11:47:28 | Araq | :P |
11:47:45 | FromGitter | <timotheecour> Wot! noone said anything about not liking math and such :) |
11:47:46 | FromGitter | <kaushalmodi> Editors can then easily take that json and present the docs in-editor however they want. |
11:48:21 | PMunch | Huh, TIL the parenthesis in procedure definition are optional if you don't need any arguments |
11:50:45 | Zevv | code is data, data is code: ``proc myconst = 42`` |
11:50:49 | FromGitter | <kaushalmodi> It's optional for many cases with arguments too |
11:51:46 | FromGitter | <kaushalmodi> PMunch: Command Invocation Syntax |
11:52:14 | PMunch | Yeah for calling, this is the declaration |
11:52:18 | FromGitter | <kaushalmodi> Oh nevermind, you said "definition", sorry |
11:52:31 | PMunch | proc test = echo "Hello" |
11:52:34 | PMunch | That's valid |
11:52:36 | FromGitter | <kaushalmodi> I was wondering why this was new |
11:52:50 | FromGitter | <kaushalmodi> PMunch: TIL too! :) |
11:53:40 | * | stefanos82 joined #nim |
11:57:35 | * | rockcavera quit (Ping timeout: 246 seconds) |
11:57:48 | Araq | in open; write; close why is the 'close' so special here that we need to put it in a finally/defer? because the ';' sequencing is a lie, it got corrupted by return/raise/break |
11:59:25 | narimiran | PMunch, @kaushalmodi: you never used `proc main = ...`? |
11:59:56 | PMunch | I've always done proc main() = |
12:02:24 | FromGitter | <kaushalmodi> narimiran: nope, because consistency :) |
12:02:54 | FromGitter | <kaushalmodi> So I never discovered this |
12:08:58 | * | dddddd joined #nim |
12:09:16 | FromGitter | <timotheecour> @araq ⏎ ⏎ > why is the 'close' so special here that we need to put it in a finally/defer? because the ';' sequencing is a lie, it got corrupted by return/raise/break ⏎ ⏎ I really don’t understand this argument; `result` pattern (as opposed to early return pattern) has exact same thing to worry about: raised exceptions can break the control flow even if you don’t have a single `return`. |
12:09:16 | FromGitter | ... [https://gitter.im/nim-lang/Nim?at=5c4afc6c0721b912a5d79d5d] |
12:13:45 | * | seni joined #nim |
12:17:05 | FromGitter | <bung87> anyone can help me with this? https://forum.nim-lang.org/t/4589 |
12:18:51 | leorize | are you on devel? |
12:19:08 | FromGitter | <bung87> yeah level 19.9 |
12:19:21 | FromGitter | <bung87> devel |
12:20:00 | leorize | are you on linux? |
12:20:29 | FromGitter | <bung87> I developing on osx and runs on it |
12:21:18 | leorize | what's the output of `ulimit -n` on your system? (run this in a shell) |
12:21:49 | FromGitter | <bung87> 256 |
12:22:07 | leorize | that's the number of available fds |
12:22:58 | leorize | try `ulimit -n hard` |
12:23:17 | leorize | then `ulimit -n` again to see the number of available fds |
12:25:47 | FromGitter | <bung87> ulimit -Hn ⏎ unlimited ⏎ ulimit -Sn ⏎ 256 [https://gitter.im/nim-lang/Nim?at=5c4b004bc45b986d11b929c1] |
12:26:22 | leorize | yea, set the fd limit to unlimited and try to run your server in that exact shell |
12:26:22 | FromGitter | <bung87> I need change the soft limit? |
12:26:31 | leorize | change the current limit |
12:26:37 | leorize | `ulimit -n unlimited` |
12:28:03 | livcd | although i think that's not a persistent change |
12:28:31 | leorize | yea, the correct one is to call setrlimit from your program |
12:28:33 | FromGitter | <bung87> https://coderwall.com/p/lfjoaq/persist-ulimit-settings-in-mac-os-x |
12:28:37 | leorize | but for testing this is alright :) |
12:28:44 | FromGitter | <bung87> I follow this article |
12:29:54 | livcd | hey bung87 you are chinese right ? |
12:30:28 | FromGitter | <bung87> why ulimit -aH shows diffrient |
12:30:38 | FromGitter | <bung87> @livecd yes |
12:30:55 | * | Snircle joined #nim |
12:32:08 | leorize | because that's the hard limit |
12:32:13 | livcd | and you have QQ right ? |
12:32:27 | FromGitter | <bung87> @leorize do you know where the problem is if I hold individual AsyncHttpClient per server |
12:33:15 | FromGitter | <bung87> livcd I have but use wechat usually |
12:34:16 | FromGitter | <bung87> I will reboot my mac, comming back soon |
12:40:52 | * | xace quit (Ping timeout: 272 seconds) |
12:43:26 | shashlick | PMunch : how about dash, docset and dashl |
12:43:37 | PMunch | Huh? |
12:44:29 | FromGitter | <bung87> @leorize works as expected.thank you! |
12:44:37 | shashlick | For doc format |
12:45:21 | PMunch | Never heard of either of those :P |
12:45:31 | * | nsf joined #nim |
12:46:09 | shashlick | https://kapeli.com/dash |
12:46:51 | shashlick | https://github.com/Kapeli/feeds |
12:47:46 | * | xace joined #nim |
12:47:53 | * | dom96_w quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
12:48:22 | livcd | bung87:do you mind asking @xcgui QQ room if they could make an english release ? |
12:50:04 | FromGitter | <bung87> um..I dont understand what you are asking for |
12:50:42 | * | Perkol joined #nim |
12:51:16 | livcd | bung87: the only care about the chinese users afaik. All of it is in chinese and you cant even get in touch without QQ. So I am asking if the author could make it available for english speakers |
12:53:55 | FromGitter | <gogolxdong> wechat has Enlish version. |
12:55:49 | FromGitter | <kaushalmodi> shashlick: I believe those are the user interfaces for docs |
12:56:03 | FromGitter | <kaushalmodi> They would need a json doc or something to render those |
12:56:33 | FromGitter | <kaushalmodi> Devdocs at least does that |
12:56:55 | FromGitter | <kaushalmodi> That actually parses the HTML docs to JSON, and then generates its own HTML |
12:58:23 | FromGitter | <bung87> livcd I see it’s a commercial project |
13:00:01 | Araq | er ... did DeepMind win SC2? |
13:00:42 | FromGitter | <bung87> yeah I see the news |
13:01:15 | Araq | wtf, I predicted it would fail until maybe 2025 |
13:01:19 | Araq | :-( |
13:03:02 | FromGitter | <bung87> haha,I see there’s a lot papers about AI gaming on https://arxiv.org/ |
13:04:31 | livcd | was not the alphazero vs stockfish a bigger deal than this ? |
13:05:30 | * | dom96_w joined #nim |
13:11:19 | * | ng0 joined #nim |
13:17:32 | * | vlad1777d joined #nim |
13:20:02 | Araq | dunno its "APM" is so high that I consider it cheating |
13:20:04 | FromGitter | <arnetheduck> er.. `result` variable and nvro have nothing to do with each other - compiler can do nrvo without the language randomly exposing a mutable variable called `result`.. using `result` however encourages you to write code where you forget to assign a value in some of the paths, specially when you're using nesting / structure ie : ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ this semantically enforces both that all |
13:20:04 | FromGitter | ... paths have a value and that the value is used for something at the end of the if block - bonus point: you don't need to build an extra control flow prover [https://gitter.im/nim-lang/Nim?at=5c4b0d0395e17b4525aa5e35] |
13:20:38 | Araq | it's help NRVO is you lack an "optimizer" |
13:21:41 | FromGitter | <arnetheduck> not really - the transformation you're doing now for `return` is exactly the same, regardless if `result` is exposed to the language or not |
13:22:59 | * | BigEpsilon joined #nim |
13:23:17 | shashlick | @kaushalmodi actually they use sqlite |
13:23:25 | shashlick | And there are open source versions |
13:23:29 | FromGitter | <arnetheduck> I'm a bit curious though.. was looking at it the other day, and it looks like the callee is responsible for clearing the `result` .. why not the caller? |
13:23:42 | shashlick | The docs can be html too |
13:24:50 | shashlick | And there are open source versions too like zeal |
13:28:42 | FromGitter | <kaushalmodi> shashlick: JSON will come to more uses than just viewing the docs in browser |
13:29:06 | Araq | NRVO is not the same as "you can move in a return statement" |
13:30:33 | Araq | NRVO does not apply when there are different return paths with different named objects. |
13:31:02 | Araq | which doesn't happen in Nim, because it's not "differently named objects", it's result, always. |
13:31:37 | Araq | but ever since I figured out the "It's the last read of the location that can be optimized" it became a very moot point. |
13:32:03 | Araq | so yeah, in today's Nim 'result' has no performance benefits. |
13:32:45 | FromGitter | <arnetheduck> yeah, that's my point :) it can happen behind the scenes and you're already doing it :) |
13:34:09 | FromGitter | <arnetheduck> from a developer perspective however, when I see result being used I tend trust the code a little less because there are more things that can go wrong, in terms of control flow |
13:36:49 | Araq | as for your question, I think zero'ing in the callee produces less code |
13:37:12 | Araq | as there are usually more callsites than entry points |
13:37:41 | Araq | but it changed a couple of times so I don't even know what we currently do |
13:45:36 | * | smitop joined #nim |
13:46:18 | smitop | Is it possible to compile the Nim compiler into javascript? |
13:50:44 | * | natrys joined #nim |
14:01:24 | FromGitter | <arnetheduck> well, right now it resets in both caller and callee: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c4b16b49bfa375aab5a8640] |
14:01:32 | FromGitter | <arnetheduck> ```proc f(): X = ⏎ result.x = "test" ⏎ ⏎ proc y() = ⏎ echo f().x``` [https://gitter.im/nim-lang/Nim?at=5c4b16bcc45b986d11b9c3b5] |
14:12:28 | JustASlacker | can anybody shed some light on https://nim-by-example.github.io/for_iterators/ |
14:13:03 | * | stefanos82 quit (Remote host closed the connection) |
14:13:23 | narimiran | JustASlacker: what is the problem? |
14:13:36 | JustASlacker | Im unsure how the connection is made between that type (is that an object) and the for loop |
14:14:03 | narimiran | yeah, it is not the best/clearest example |
14:14:14 | JustASlacker | pairs is used because it returns a tuple? |
14:14:23 | narimiran | what would you like to do with your iterator? or are you just following that tutorial? |
14:14:31 | JustASlacker | just following |
14:14:56 | JustASlacker | Ive used python for years and I stumple upon nim while checking out nimpy |
14:15:02 | JustASlacker | or is it pynim |
14:15:10 | narimiran | nimpy, probably :) |
14:15:12 | JustASlacker | https://github.com/yglukhov/nimpy |
14:15:13 | JustASlacker | yeah |
14:15:35 | FromGitter | <arnetheduck> > as there are usually more callsites than entry points ⏎ ⏎ good point.. though the caller knows more about the state of the variable at call site.. reminds me of.. what was it.. pascal vs c calling convention :) |
14:16:15 | narimiran | JustASlacker: so, nim has several built-in iterators, such as `items` and `pairs`, and that example tries to show what they do behind the scenes. and you're right about pairs returning (index, element) tuple |
14:18:49 | JustASlacker | yeah, it literally the first line on that page |
14:18:57 | JustASlacker | it read the code but not the text |
14:19:02 | JustASlacker | thanks tho |
14:21:02 | narimiran | JustASlacker: haha, no problem. i'm also coming from python background, btw. and my advise for you is to just start using nim for some simple problems (i started by translating some of my python scripts, so i could easily compare them), and soon enough you'll be hooked :) |
14:21:30 | FromGitter | <kaushalmodi> JustASlacker: Check out https://scripter.co/notes/nim/#for-loops-and-iterators |
14:22:06 | FromGitter | <kaushalmodi> They are my notes on Nim; that section is me interpreting that exact section from Nim by Example |
14:22:08 | JustASlacker | narimiran: yeah, I doodling a bit as wel |
14:22:34 | FromGitter | <kaushalmodi> Let me know where I need to clear up things in those notes. |
14:22:44 | JustASlacker | the only think I kinda dislike for now is that its unclear where a function comes from |
14:22:52 | JustASlacker | like from foo import bar |
14:23:00 | JustASlacker | or just import foo |
14:23:03 | JustASlacker | and do foo.bar |
14:23:21 | FromGitter | <kaushalmodi> That import bit is subjective |
14:23:27 | JustASlacker | that seems to be kinda hidden in nim versus python |
14:23:37 | JustASlacker | kaushalmodi: thx |
14:23:37 | narimiran | JustASlacker: yeah, that bothered me (and lots of others) when i first tried nim. but you get used to it and kinda appreciate :) |
14:23:45 | JustASlacker | we shall see :P |
14:24:40 | FromGitter | <kaushalmodi> If you like python style, there's an option to import nothing too |
14:24:41 | narimiran | JustASlacker: in python that would be a mess (and `from foo import *` is discouraged), but in nim you have types, so `foo(int)` and `foo(string)` are two completely different functions |
14:24:46 | * | gangstacat quit (Quit: Ĝis!) |
14:24:58 | FromGitter | <kaushalmodi> Then you have to do moduleName.proc each time. |
14:25:00 | leorize | when I first saw that I thought it would be like pascal. luckily it doesn't |
14:25:47 | JustASlacker | so, I can do module.proc ? |
14:25:52 | narimiran | leorize: it is 15 years or so since i used pascal :D what is pascal's way? |
14:26:41 | narimiran | JustASlacker: you can, and you'll be happy at first, until you won't be able to do `a + b`, because you'll need `module.+(module.a, module.b)` :D |
14:26:42 | leorize | the pascal import is basically: the module "use"-ed later will override the earlier one symbol |
14:27:21 | FromGitter | <kaushalmodi> See https://nim-lang.github.io/Nim/tut1.html#modules-from-statement |
14:27:42 | FromGitter | <kaushalmodi> The `from foo import nil` |
14:27:54 | FromGitter | <kaushalmodi> But note that that's not canonical Nim |
14:28:14 | FromGitter | <kaushalmodi> You are unnecessarily making your code verbose with that |
14:28:49 | FromGitter | <kaushalmodi> Nim is a compiled language so you don't need extra code to prevent user errors |
14:29:05 | JustASlacker | kay |
14:29:15 | JustASlacker | any documentation on the async part of nim somewhere? |
14:29:25 | JustASlacker | I see it has some async enabled libraries |
14:29:35 | leorize | see asyncdispatch module |
14:30:06 | JustASlacker | ah, so its a module |
14:30:51 | FromGitter | <kaushalmodi> I'd recommend bookmarking https://nim-lang.github.io/Nim/theindex.html |
14:31:25 | FromGitter | <kaushalmodi> Just use the browser Ctrl+F to search anything on that page |
14:32:42 | JustASlacker | thx |
14:45:02 | * | PMunch quit (Remote host closed the connection) |
14:52:22 | * | Perkol quit (Remote host closed the connection) |
14:58:11 | * | gangstacat joined #nim |
15:04:31 | * | elrood joined #nim |
15:12:27 | * | Marumoto joined #nim |
15:12:46 | * | skellock joined #nim |
15:13:44 | * | JustASlacker quit (Remote host closed the connection) |
15:15:24 | * | Marumto quit (Ping timeout: 272 seconds) |
15:36:08 | * | narimiran quit (Remote host closed the connection) |
15:36:45 | * | noonien quit (Ping timeout: 252 seconds) |
15:37:11 | * | darithorn joined #nim |
15:39:11 | * | noonien joined #nim |
15:41:10 | * | Sembei joined #nim |
15:43:16 | * | Pisuke quit (Ping timeout: 268 seconds) |
15:48:52 | * | absolutejam quit (Quit: WeeChat 1.9.1) |
15:51:29 | * | salewski joined #nim |
15:52:29 | salewski | Related to recent forum post of oister I wonder why conversion of int/cint to pointer is not allowed: |
15:52:43 | salewski | var x: int |
15:53:00 | salewski | var p: pointer = pointer(x) |
15:53:22 | salewski | t.nim(20, 25) Error: type mismatch: got <int> but expected 'pointer' |
15:53:39 | salewski | Bye. |
15:54:54 | * | rockcavera joined #nim |
15:58:56 | * | abm quit (Ping timeout: 240 seconds) |
16:11:43 | dom96_w | Because it's an unsafe cast |
16:12:02 | dom96_w | There is absolutely no guarantee this is memory safe |
16:12:13 | dom96_w | And so you need to use cast[pointer](x) |
16:13:52 | smitop | How do you append to a `seq`? |
16:14:05 | dom96_w | add |
16:18:33 | salewski | Yes it is unsafe, I think I will never use it myself. But I thougth a conversion is better for 4 byte cint to 8 byte pointer |
16:19:15 | salewski | than a cast. I am never sure what cast does for different data sizes. Will do some test eventually. |
16:19:40 | salewski | Bye. |
16:19:42 | * | salewski quit (Quit: WeeChat 2.3) |
16:21:52 | * | floppydh quit (Quit: WeeChat 2.3) |
16:22:22 | * | salewski joined #nim |
16:23:20 | salewski | smitop, we use add() for that, I think it is from system module. |
16:23:28 | * | salewski quit (Client Quit) |
16:24:29 | * | stefanos82 joined #nim |
16:46:16 | * | gangstacat quit (Remote host closed the connection) |
16:49:13 | jxy | what exactly is cast supposed to do in Nim? |
16:50:16 | jxy | what happens if I cast a cint to a pointer? What happens if I cast a pointer to a cint? |
16:50:53 | jxy | what if it is a int32, but not a cint? |
16:58:59 | shashlick | cast is unsafe, so totally depends on you doing the right thing |
16:59:39 | shashlick | if you case from pointer to wrong size, you could lose info |
16:59:52 | shashlick | if you cast to pointer from the wrong data type, you are pointing to random memory spot |
17:00:02 | shashlick | crashes will become your friend |
17:10:03 | * | skellock quit (Ping timeout: 245 seconds) |
17:12:02 | * | lritter quit (Quit: Leaving) |
17:21:36 | * | narimiran joined #nim |
17:24:38 | * | skellock joined #nim |
17:29:02 | * | skellock quit (Ping timeout: 250 seconds) |
17:32:37 | * | skellock joined #nim |
17:33:32 | * | narimiran quit (Remote host closed the connection) |
17:34:29 | * | narimiran joined #nim |
17:37:21 | * | skellock quit (Ping timeout: 268 seconds) |
17:42:50 | * | narimiran quit (Remote host closed the connection) |
17:43:27 | * | narimiran joined #nim |
17:54:41 | * | nsf quit (Quit: WeeChat 2.3) |
18:01:35 | * | wildlander joined #nim |
18:06:51 | * | krux02 quit (Remote host closed the connection) |
18:12:06 | * | banc quit (Ping timeout: 272 seconds) |
18:14:40 | * | Trustable joined #nim |
18:15:14 | * | banc joined #nim |
18:18:34 | * | skellock joined #nim |
18:29:12 | * | zachk joined #nim |
18:30:03 | * | zachk quit (Read error: Connection reset by peer) |
18:30:27 | * | zachk joined #nim |
18:35:33 | * | zachk quit (Changing host) |
18:35:33 | * | zachk joined #nim |
18:36:56 | * | skellock quit (Ping timeout: 246 seconds) |
18:43:12 | * | narimiran quit (Remote host closed the connection) |
18:43:17 | shashlick | @kaushalmodi - any idea why version-0-19 build is fast on Linux/OSX (due to caching) but Windows still takes full time? |
18:43:51 | * | narimiran joined #nim |
18:43:54 | * | narimiran quit (Remote host closed the connection) |
18:46:31 | * | Perkol joined #nim |
18:47:12 | Perkol | Does jester framework have any sort of template system? |
18:48:36 | * | gangstacat joined #nim |
18:48:39 | * | narimiran joined #nim |
18:57:33 | FromGitter | <Varriount> Perkol: I think so. |
18:58:23 | FromGitter | <Varriount> shashlick: Embrace crashes. Let them into your life. 😜 |
18:58:34 | * | Trustable quit (Remote host closed the connection) |
18:59:42 | * | Trustable joined #nim |
19:02:36 | * | dom96_w quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
19:02:55 | shashlick | now that Araq and krux02 posted that gdb video, perhaps I can! |
19:02:56 | FromGitter | <iffy> How do I print a pointer address? |
19:03:44 | FromGitter | <Varriount> echo repr(addr variable) |
19:04:04 | smitop | How can I read a config file at compile time? |
19:04:09 | FromGitter | <Varriount> Or cat the variable to a pointer |
19:04:23 | FromGitter | <Varriount> smitop: What's the config format? |
19:04:54 | smitop | A file that can be read by `parsecfg` |
19:06:06 | FromGitter | <iffy> @Varriount that prints the whole cstring... any way to get just the address? |
19:09:18 | * | xet7 joined #nim |
19:19:46 | * | Trustable quit (Remote host closed the connection) |
19:21:33 | * | Trustable joined #nim |
19:21:43 | FromGitter | <timotheecour> ya |
19:22:09 | FromGitter | <timotheecour> toHex |
19:22:48 | FromGitter | <iffy> mycstring.unsafeAddr.toHex? |
19:23:10 | FromGitter | <iffy> hmm.. compiler doesn't like that. Do I need to import something? |
19:23:52 | FromGitter | <timotheecour> `toHex(cast[int]foo.addr) ` ; in strutils |
19:24:55 | FromGitter | <iffy> Had to do: `toHex(castint (mycstring.unsafeAddr))` |
19:25:04 | FromGitter | <timotheecour> ya |
19:25:13 | FromGitter | <iffy> awesome, that works great! |
19:32:45 | * | Perkol quit (Quit: Leaving) |
19:34:49 | FromGitter | <iffy> Going from C++ -> Nim, if I have `const char* somestring = ...; mylib_echo((char *)(somestring));` from Nim's perspective, did I just call `mylib_echo` with a `cstring` or a `ptr cstring`? |
19:36:03 | FromGitter | <timotheecour> my 97% bet: a cstring |
19:36:17 | * | Tyresc joined #nim |
19:36:21 | FromGitter | <timotheecour> but u can verify by printing address; let me know when u check! |
19:36:56 | FromGitter | <timotheecour> Ptr cstring would be double pointer |
19:37:27 | FromGitter | <iffy> the `toHex(...)` value is 00007FFF5FBF9210 and the `repr(x.unsafeAddr)` value is: `ref 0x7fff5fbf9210 --> 0x1028178b0"SELECT * ..."` |
19:38:44 | * | BigEpsilon quit (Quit: WeeChat 2.3) |
19:38:45 | FromGitter | <iffy> @timotheecour ^ |
19:39:33 | FromGitter | <timotheecour> with x : cstring = arg_passed_from_c. and c passing `char*`? |
19:39:44 | FromGitter | <iffy> yep |
19:39:52 | FromGitter | <iffy> C++ if that makes a difference |
19:40:53 | FromGitter | <timotheecour> maybe easiest would be add complete minimal code in ur repo and i can look? (Easier than in a gist if i need to run it; so i can just git clone and run :) ) |
19:41:33 | FromGitter | <iffy> Do you have node installed? If not, I can see if it's the same with just the C++ + Nim version |
19:45:10 | * | Yardanico quit (Quit: No Ping reply in 180 seconds.) |
19:46:29 | * | Yardanico joined #nim |
19:52:59 | FromGitter | <iffy> @timotheecour https://github.com/iffy/vitanim/blob/address-stuff/testcases/tests/t0126/test.cpp |
19:54:01 | * | gangstacat quit (Quit: Ĝis!) |
19:54:13 | * | zyklon joined #nim |
19:56:09 | FromGitter | <iffy> ok, it's a cstring, not a ptr cstring |
19:59:27 | FromGitter | <timotheecour> ok thx for confirming :) |
20:00:50 | FromGitter | <timotheecour> i do have node; but i couldnt’ run ur code other day because of node-gyp |
20:00:52 | FromGitter | <timotheecour> (not sure how/where to get it) |
20:00:59 | FromGitter | <timotheecour> added plotting , say it? |
20:01:08 | FromGitter | <timotheecour> *saw |
20:01:17 | FromGitter | <iffy> oh hrm... I thought npm i would get node-gyp |
20:01:36 | FromGitter | <timotheecour> btw what’s `hrm` again? |
20:01:43 | FromGitter | <timotheecour> (on osx) |
20:02:02 | FromGitter | <iffy> hrm == confounded humming |
20:03:00 | FromGitter | <iffy> Yep, I see the plotting. So the program just take a lot of memory |
20:05:08 | FromGitter | <timotheecour> > I see that memory goes up and down ⏎ ⏎ what metric ? |
20:05:25 | shashlick | have we deleted older nim tar.gz from http://nim-lang.org? |
20:05:39 | shashlick | trying to install 0.15.0 and its not there |
20:06:53 | FromGitter | <iffy> @timotheecour occupied memory from GC_getStatistics |
20:18:02 | Araq | shashlick: we never delete any older Nims |
20:24:45 | FromGitter | <genotrance> ya the .xz is there but there's no gz |
20:24:54 | FromGitter | <genotrance> did you release gz files back then? |
20:27:12 | FromGitter | <timotheecour> @iffy PTAL https://github.com/timotheecour/vitanim/commit/e5c8de5e218771f59f66a4afc306ddc1a902093f |
20:27:47 | FromGitter | <timotheecour> can u send me a PR so i can repro what u’re observing here: `If I change the iterations to 10000 memory usage still goes up and down, but ends up at ~1.5MB` ? |
20:33:44 | * | skellock joined #nim |
20:38:02 | * | skellock quit (Ping timeout: 246 seconds) |
20:38:10 | * | nsf joined #nim |
20:43:52 | * | skellock joined #nim |
20:47:34 | Araq | probably no .gz, why does it matter |
20:57:07 | * | vonHabsi joined #nim |
21:01:21 | * | gangstacat joined #nim |
21:02:47 | dom96 | shashlick: you've asked this before I think |
21:03:08 | dom96 | 0.15.0 is before choosenim so I didn't bother rearchiving those past versions in .gz |
21:03:11 | dom96 | I doubt they even wor |
21:03:13 | dom96 | *work |
21:03:25 | dom96 | well, I guess they might |
21:03:36 | dom96 | but I don't think there is much point in getting them |
21:05:17 | FromGitter | <Vindaar> @timotheecour "TOOD: convert to nimpy or something :)" FTFY: https://github.com/timotheecour/vitanim/pull/5 :P |
21:05:55 | dom96 | nimpy really is cool |
21:06:07 | * | gangstacat quit (Client Quit) |
21:06:08 | dom96 | Can someone write a blog post about it on nim-lang.org? :) |
21:10:52 | narimiran | +1 |
21:11:49 | FromGitter | <Vindaar> It really is! Although for plotting I prefer plotly by now. :) And I've been meaning to write stuff :( |
21:12:37 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
21:12:47 | narimiran | @Vindaar ploty used from nim or? |
21:13:02 | FromGitter | <Vindaar> yes |
21:13:27 | narimiran | i briefly tried plotly back when i was doing python, but i just scratched the surface, never properly tested it |
21:15:02 | narimiran | but yeah, somebody else can write about nimpy, and you @Vindaar can write about nim+plotly :) |
21:15:02 | * | rockcavera quit (Read error: Connection reset by peer) |
21:15:15 | * | rockcavera joined #nim |
21:15:26 | * | skellock quit (Quit: WeeChat 2.3) |
21:16:47 | FromGitter | <Vindaar> Will try to do that |
21:18:17 | * | zyklon quit (Ping timeout: 246 seconds) |
21:18:36 | * | rockcavera quit (Remote host closed the connection) |
21:20:17 | shashlick | dom96: ya i was working on a csources PR but doesn't seem worth it |
21:20:21 | shashlick | will rather work on xz support |
21:28:44 | FromGitter | <kaushalmodi> @Vindaar This might be a stupid question, but does plotly work based of an API? |
21:28:51 | FromGitter | <kaushalmodi> or can it work completely offline? |
21:31:33 | FromGitter | <Vindaar> What it currently does is convert Nim's plotly commands to JsonNodes, which are then dumped to an Html file. The file loads the latest plotly.js release: https://github.com/brentp/nim-plotly/blob/master/src/plotly/tmpl_html.nim#L7 |
21:31:53 | FromGitter | <Vindaar> In principle nim plotly could ship a version of plotly.js to use it completely offline of course |
21:33:16 | * | zyklon joined #nim |
21:43:50 | * | narimiran quit (Ping timeout: 250 seconds) |
21:50:28 | * | shpx joined #nim |
21:59:26 | federico3 | https://ci.appveyor.com/project/FedericoCeratto/nim/ any idea on why the appveyor VM is unable to find an ssl symbol? |
21:59:46 | * | abm joined #nim |
22:03:03 | * | Trustable quit (Remote host closed the connection) |
22:10:23 | FromGitter | <timotheecour> @shashlick @dom96 maybe it was me who had asked about prior nim (see https://github.com/dom96/choosenim/issues/66) |
22:11:06 | FromGitter | <timotheecour> @vindaar thx again for that PR! much much appreciated |
22:11:07 | * | a_b_m joined #nim |
22:14:25 | * | abm quit (Ping timeout: 246 seconds) |
22:19:38 | * | zyklon quit (Read error: Connection reset by peer) |
22:19:59 | FromGitter | <Vindaar> Glad to help! |
22:20:09 | FromGitter | <kaushalmodi> @Vindaar thanks .. now I am looking if nim-plotly can plot FFT plots |
22:20:50 | FromGitter | <kaushalmodi> going down a rabbit hole now .. need to figure out how to calc fft etc in Nim |
22:22:22 | * | nsf quit (Quit: WeeChat 2.3) |
22:23:14 | FromGitter | <kaushalmodi> I am going through https://plot.ly/python/fft-filters/, but cannot see where the fft calculation is happening |
22:24:22 | FromGitter | <iffy> If I do `var x:string = "something"; p:pointer = ...; moveMem(p, x[0].addr, x.len)` will a null byte be written at the end? |
22:24:45 | FromGitter | <iffy> Actually... now I'm wondering if moveMem works when the source is a string |
22:28:10 | FromGitter | <timotheecour> > will a null byte be written at the end? ⏎ ⏎ why would it? last byte written shd be ‘g’ no? |
22:28:23 | FromGitter | <timotheecour> (u’re moving x.len bytes only) |
22:28:46 | FromGitter | <timotheecour> (also… u can just try and see!) |
22:30:14 | FromGitter | <timotheecour> @iffy u said `If I change the iterations to 10000 memory usage still goes up and down, but ends up at ~1.5MB` but i’m not observing this at all; do u mind sending a PR so i can reproduce? |
22:30:28 | FromGitter | <iffy> @timotheecour yeah, I sent one |
22:30:44 | FromGitter | <tweenietomatoes> timothee dont forget that im your biggest fan ! |
22:31:11 | FromGitter | <iffy> @timotheecour How do I see that? I'm not very good with nim and looking at what's in memory. How do I print out X bytes of memory? |
22:31:20 | FromGitter | <timotheecour> lol thx |
22:33:02 | FromGitter | <Vindaar> @kaushalmodi Sure, why not. To calculate FFTs I only know about these two wrappers: https://github.com/ziotom78/nimfftw3 and https://github.com/m13253/nim-kissfft. Well, the first is officially archived and the second hasn't been updated in 3 years. Played around with the latter about a year ago |
22:33:33 | FromGitter | <kaushalmodi> yep, my search got me to nim-kissfft |
22:33:46 | FromGitter | <kaushalmodi> good news is that kissfft C library is actively maintained |
22:34:05 | FromGitter | <kaushalmodi> If I go down that path, I might try using nimterop + kissfft directly |
22:38:01 | FromGitter | <Vindaar> If nimterop doesn't work well, updating nim-kissfft shouldn't be a problem either |
22:41:13 | * | Jesin quit (Quit: Leaving) |
22:42:54 | * | shpx quit (Quit: shpx) |
22:44:14 | * | shpx joined #nim |
22:49:10 | FromGitter | <kaushalmodi> @Vindaar I got nim-kissfft to compile |
22:49:23 | FromGitter | <kaushalmodi> after these fixes ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c4b9273975714406b4089e9] |
22:49:30 | FromGitter | <kaushalmodi> I was surprised that that's all it took |
22:49:43 | FromGitter | <kaushalmodi> though .. not sure what to do with the example it has in its readme .. |
22:49:57 | FromGitter | <kaushalmodi> Do you happen to have the code when you played with nim-kissfft? |
22:53:41 | FromGitter | <kaushalmodi> hmm, turns out this `Complex` type change was not released in 0.19.2 |
22:54:22 | FromGitter | <kaushalmodi> in 0.19.2 (https://nim-lang.org/docs/complex.html#Complex) -> in devel (https://nim-lang.github.io/Nim/complex.html#Complex) |
22:55:08 | FromGitter | <timotheecour> @iffy > @timotheecour How do I see that? I'm not very good with nim and looking at what's in memory. How do I print out X bytes of memory? ⏎ ⏎ many ways: hex dump, using gdb/lldb; or simply casting to a string and printing it; ⏎ ⏎ ```code paste, see link``` ... [https://gitter.im/nim-lang/Nim?at=5c4b93ccceb5a2264f3f35f5] |
22:55:13 | * | smitop quit (Quit: Connection closed for inactivity) |
22:56:13 | FromGitter | <timotheecour> @kaushalmodi cool can u send a PR against nim-kissFFT since u already did the work ;-) ? |
22:56:36 | FromGitter | <kaushalmodi> @timotheecour I cannot .. the change is applicable only for nim devel atm |
22:56:44 | FromGitter | <kaushalmodi> will send a PR though and let it sit there |
22:59:06 | FromGitter | <Vindaar> @kaushalmodi I'll see if I still have that code somewhere |
23:00:07 | shashlick | @timotheecour ya I can enable older Nim versions of there's interest |
23:01:04 | shashlick | If |
23:01:13 | FromGitter | <timotheecour> @kaushalmodi yes u can: see https://github.com/nitely/nim-regex/pull/34/files |
23:01:16 | * | Jesin joined #nim |
23:02:30 | FromGitter | <kaushalmodi> wow, the nim-kissfft dev already merged my PR's |
23:02:46 | FromGitter | <kaushalmodi> even the one that was nim devel specific .. oh well |
23:03:18 | FromGitter | <kaushalmodi> @timotheecour good idea, will do that |
23:06:28 | * | zachcarter joined #nim |
23:07:38 | FromGitter | <timotheecour> @kaushalmodi @Vindaar regarding FFT performance: according to https://kfrlib.com/storage/app/media/fft.png KFR seems top-notch, beating fftw, IPP and kissfft, AND is open source: https://github.com/kfrlib/kfr |
23:08:09 | FromGitter | <timotheecour> it has a C API, maybe nimterop could do wonders? |
23:08:46 | FromGitter | <kaushalmodi> @timotheecour Thanks, I will try that out later. I was just looking into a way to plot stuff .. |
23:09:07 | FromGitter | <kaushalmodi> and then I thought that I should look into plotting ffts as that would be useful at work .. |
23:09:15 | FromGitter | <kaushalmodi> and then nim-kissfft .. |
23:09:26 | FromGitter | <kaushalmodi> (rabbithole is getting deeper) |
23:09:27 | FromGitter | <kaushalmodi> :P |
23:09:27 | FromGitter | <timotheecour> yaya makes sense; although i think @mratsim may be interested in high performance FFT for arraymancer (cpu based convnets) |
23:10:08 | FromGitter | <timotheecour> ya very familiar w the rabbit :) guilty as charged too |
23:10:27 | FromGitter | <kaushalmodi> oh may be shashlick if he's maintaining a list of tests for nimterop :P |
23:10:44 | FromGitter | <kaushalmodi> Hint: the kfr project ^ |
23:13:00 | * | natrys quit (Quit: natrys) |
23:14:33 | shashlick | I can take a look but neck deep in nimterop dev and maintenance |
23:16:11 | FromDiscord_ | <exelotl> uhh does anyone have experience with getting nim to output header files? |
23:19:10 | FromGitter | <kaushalmodi> shashlick: certainly! this is a reaaaaly low priority request |
23:19:14 | FromGitter | <kaushalmodi> don't burn yourself out |
23:21:08 | FromGitter | <Vindaar> @kaushalmodi ehm, as a matter of fact I still have some kissfft code lying around *cough*. Guess 2017 me had some plans with it: https://github.com/Vindaar/TimepixAnalysis/blob/master/Analysis/ingrid/fadc_helpers.nim#L470-L513 |
23:21:40 | FromGitter | <Vindaar> to be honest, I don't know whether this code really worked or if I modified it somewhere else back then |
23:21:58 | shashlick | What does toast say for kfr? Are there any issues? |
23:22:09 | shashlick | Plugin system is at 70% |
23:22:23 | FromGitter | <kaushalmodi> shashlick: honestly, I haven't tried |
23:22:57 | FromGitter | <kaushalmodi> Just going through its readme made it feel too out of reach for me |
23:23:36 | FromGitter | <kaushalmodi> @Vindaar what I don't understand is that the example has fin and fout |
23:24:28 | FromGitter | <kaushalmodi> the kind of FFT I am looking at is where input is a series of samples in *time* domain, the sampling frequency and I get an (x,y) response of frequency/power |
23:24:42 | FromGitter | <kaushalmodi> .. in output |
23:24:47 | FromGitter | <kaushalmodi> which I can then plot in plotly |
23:26:18 | FromGitter | <kaushalmodi> I am looking for an example equivalent to https://www.mathworks.com/help/matlab/ref/fft.html |
23:26:56 | * | banc quit (Ping timeout: 240 seconds) |
23:35:17 | * | banc joined #nim |
23:39:19 | FromGitter | <Vindaar> Yeah, that was what I originally wanted back then too |
23:39:51 | * | elrood quit (Remote host closed the connection) |
23:40:02 | * | shpx quit (Quit: shpx) |
23:40:23 | FromGitter | <Vindaar> I hardly have to do any FFTs, so I'm always a little confused about it |
23:43:58 | * | gangstacat joined #nim |
23:49:48 | * | a_b_m quit (Quit: Leaving) |
23:59:31 | * | darithorn quit (Quit: Leaving) |