00:03:10 | ldlework | dom96: also, are there any other options? |
00:03:41 | Araq | ldlework: seems to be tricky support -.- but it surely does count as a bug |
00:04:52 | * | allan0 quit (Ping timeout: 248 seconds) |
00:05:00 | ldlework | It allows me to do exactly what the method version is doing without the methods, I think. |
00:05:09 | * | allan0 joined #nim |
00:05:39 | ldlework | If this would be possible then library extension isn't so bad actually. |
00:05:46 | ldlework | filcuc: agree? |
00:07:30 | filcuc | ldlework: probably i've to see if i can adapt it to my use case |
00:08:16 | * | Dildosan quit (Quit: Leaving) |
00:08:49 | filwit | Araq: will you keep the existing non-incremental cycle-scanner around? Or is the new design theoretically better all around? |
00:08:58 | filwit | Araq: ^ about the new GC |
00:09:02 | filcuc | ldlework: from what i see concepts are fine for behaviour |
00:09:19 | ldlework | filcuc: you can even specify field constraints too I think |
00:11:15 | * | filippo joined #nim |
00:11:19 | filwit | Araq: ie, is there some trade in memory/throughput you're making with the new GC that may be significant enough to where people would want the current solution of the new design for some applications? |
00:11:20 | * | filippo is now known as filcuc_ |
00:11:44 | filcuc_ | [01:07] <filcuc> ldlework: from what i see concepts are fine for behaviour |
00:11:46 | filcuc_ | [01:08] <filcuc> ldlework: but they don't serve me well for enforcing initialization |
00:11:47 | filcuc_ | [01:08] <filcuc> ldlework: but i think that my use case can be worked around as i explained to you early |
00:15:08 | * | filcuc quit (Ping timeout: 240 seconds) |
00:15:08 | * | brson quit (Ping timeout: 240 seconds) |
00:15:08 | * | M-Quora quit (Ping timeout: 240 seconds) |
00:15:08 | * | dyce quit (Ping timeout: 240 seconds) |
00:15:14 | * | M-max joined #nim |
00:16:04 | * | brson joined #nim |
00:16:18 | * | dyce_ joined #nim |
00:18:16 | filcuc_ | gn |
00:18:44 | * | filcuc_ quit (Quit: Konversation terminated!) |
00:18:54 | * | yglukhov joined #nim |
00:24:16 | * | yglukhov quit (Remote host closed the connection) |
00:25:16 | Araq | filwit: once gc:v2 works, the old GC will be removed |
00:26:14 | filwit | Araq: k. BTW have to done any initial benchmarks to compare them, or are you still just working on getting the kinks out. |
00:27:01 | filwit | Araq: the only reason I ask is because I quickly read the tri-color wiki explanation, and it sounded like it would be using more memory.. so just curious |
00:27:43 | Araq | it will be faster, if I can even get it to work reliably |
00:39:44 | gokr | I tried GCv2 in Ni, it was a bit faster, IIRC 10-15%. |
00:39:54 | gokr | For a silly benchmark. |
00:40:29 | gokr | Which of course says nothing - but it *was* faster. |
00:41:21 | gokr | Araq: Finally got something that actually works. But.. I had to go gc:none, which of course is not funny. |
00:42:47 | gokr | Since I am completely stupid on this level - when a function is called in another object (stdlib_system.o), does that trigger something else to happen in that module? Can't really understand why I couldn't even call the empty systemDatInit000. |
00:53:28 | * | derka quit (Quit: derka) |
00:54:36 | * | desophos quit (Read error: Connection reset by peer) |
00:54:45 | * | M-Quora joined #nim |
00:56:35 | * | M-max quit (Quit: node-irc says goodbye) |
01:00:24 | Araq | gokr: no, it's just as confusing to me |
01:00:56 | gokr | I wonder if it has to do with... link.ld etc, lots of stuff here that I have no idea what it is. |
01:01:22 | gokr | Tried markAndSweep, same result. |
01:01:53 | * | sarlalian quit (Quit: WeeChat 0.4.2) |
01:02:58 | * | sarlalian joined #nim |
01:04:27 | Araq | it seems to have something to do with the GC's initialization |
01:04:46 | Araq | markAndSweep uses the same initialization |
01:05:20 | gokr | yeah |
01:05:40 | * | jaco60 quit (Ping timeout: 252 seconds) |
01:07:24 | * | saml_ joined #nim |
01:41:34 | dyce_ | is there an observer pattern for nim like ReactiveX? |
01:42:51 | ldlework | no do you think you'll make one? |
01:43:08 | dyce_ | once i become an expert, sure :D |
02:19:26 | * | dashed joined #nim |
02:27:40 | * | gokr quit (Ping timeout: 256 seconds) |
02:41:49 | * | Demon_Fox quit (Quit: Leaving) |
03:05:35 | * | brson quit (Ping timeout: 264 seconds) |
03:38:10 | * | namra joined #nim |
03:39:55 | * | ephja quit (Ping timeout: 240 seconds) |
03:48:54 | * | desophos joined #nim |
04:12:13 | * | filwit quit (Quit: Leaving) |
04:24:33 | * | saml_ quit (Remote host closed the connection) |
04:35:02 | * | dmitry_p joined #nim |
04:51:56 | * | lompik quit (Ping timeout: 240 seconds) |
05:04:03 | * | endragor joined #nim |
05:07:06 | * | Demon_Fox joined #nim |
05:07:34 | * | darkf quit (Read error: Connection reset by peer) |
05:08:26 | * | jsudlow quit (Read error: Connection reset by peer) |
05:09:03 | * | darkf joined #nim |
05:09:30 | * | jackv quit (Ping timeout: 252 seconds) |
05:09:37 | * | zxtx quit (Read error: Connection reset by peer) |
05:09:51 | * | jackv joined #nim |
05:10:02 | * | zxtx joined #nim |
05:10:16 | * | jsudlow joined #nim |
05:10:35 | * | StarBrilliant quit (Ping timeout: 240 seconds) |
05:10:55 | * | Xe quit (Ping timeout: 240 seconds) |
05:11:40 | * | Xe joined #nim |
05:12:50 | * | StarBrilliant joined #nim |
05:16:40 | * | silven quit (Ping timeout: 250 seconds) |
05:17:02 | * | silven joined #nim |
05:22:32 | * | s4 joined #nim |
05:25:01 | * | yglukhov joined #nim |
05:30:22 | * | yglukhov quit (Remote host closed the connection) |
06:00:23 | * | dashed quit (Quit: Connection closed for inactivity) |
06:18:35 | * | BitPuffin|osx quit (Ping timeout: 240 seconds) |
06:32:18 | * | ephja joined #nim |
06:39:06 | * | onionhammer quit (Ping timeout: 240 seconds) |
06:49:01 | * | gokr joined #nim |
06:49:14 | * | gokr quit (Client Quit) |
06:51:10 | * | toaoMgeorge quit (Ping timeout: 256 seconds) |
07:05:20 | ldlework | https://gist.github.com/dustinlacewell/a1194610e036434ad888 |
07:07:07 | * | onionhammer joined #nim |
07:32:18 | * | Varriount joined #nim |
07:35:48 | * | Varriount_ quit (Ping timeout: 272 seconds) |
07:42:46 | * | endragor quit (Remote host closed the connection) |
08:01:07 | ldlework | I kinda seems like closures are slow... |
08:02:28 | * | endragor joined #nim |
08:05:49 | ldlework | I remember the reason that I ported from Javascript was because I could not generate simple random tiles as fast as I could scroll the camera |
08:06:07 | ldlework | But it seems I'm getting about the same performance |
08:06:14 | ldlework | I wonder if I'm doing something overtly inefficient |
08:06:23 | ldlework | I mean, other than calling a user closure for each tile on the screen |
08:07:45 | ldlework | I would think that native code could call a couple functions a few dozen times a frame |
08:17:47 | * | gokr joined #nim |
08:18:32 | * | Trustable joined #nim |
08:49:02 | * | Demon_Fox quit (Read error: Connection reset by peer) |
08:49:20 | * | Demon_Fox joined #nim |
08:50:59 | * | darkf quit (Quit: Leaving) |
09:20:01 | * | jaco60 joined #nim |
09:20:14 | * | coffeepot joined #nim |
09:21:32 | * | s4 quit (Remote host closed the connection) |
09:22:17 | * | s4 joined #nim |
09:50:22 | * | toaoMgeorge joined #nim |
09:58:24 | * | desophos quit (Read error: Connection reset by peer) |
10:19:50 | * | Demon_Fox quit (Quit: Leaving) |
10:27:46 | * | toaoMgeorge quit (Ping timeout: 240 seconds) |
10:29:36 | * | toaoMgeorge joined #nim |
10:31:56 | * | s4 quit (Remote host closed the connection) |
10:33:53 | endragor | Is there a way to simulate multiple inheritance when interfacing with C++? `of` works well when the class inherits single other class, but it doesn't allow to specify multiple classes. |
10:35:18 | * | s4 joined #nim |
10:36:11 | Araq | endragor: you can use a converter to tell Nim about the additional subtyping |
10:37:33 | endragor | Araq: that should work. thanks! |
11:32:36 | Varriount | ldlework: Time for a profiler? |
11:35:02 | Varriount | ldlework: Looking at the snippet you posted, a fair amount of string copying is going on. Have you marked them as shallow? |
12:03:05 | * | dmitry_p quit (Remote host closed the connection) |
12:30:56 | * | toaoMgeorge quit (Ping timeout: 272 seconds) |
12:31:09 | * | lompik joined #nim |
12:31:18 | * | nthxw joined #nim |
12:45:13 | * | filwit joined #nim |
12:48:15 | * | toaoMgeorge joined #nim |
13:14:07 | * | saml joined #nim |
13:22:05 | * | s4 quit (Quit: Konversation terminated!) |
13:41:46 | gokr | https://github.com/gokr/ardunimo |
13:42:04 | * | exebook joined #nim |
13:44:30 | filwit | gokr: nice :) |
13:45:21 | filwit | gokr: btw, you probably can't turn the GC on due to memory limitations on those boards (depending on the boards you're testing with) |
13:46:09 | * | mahasamoot joined #nim |
13:48:11 | * | Dildosan joined #nim |
13:48:30 | coffeepot | Nice, gokr :) I've been wonder what Nim would be like on an arduino! |
13:48:55 | filwit | gokr: my brother tried to get Nim working on his many various Audrino and micro-controller chips, but most have something like 1-2k memory (some much less, some much higher).. and Nim's allocator requires 4k min (cause it uses `mmap` to acquire memory from the system.. and that function either doesn't exist on these bare-metal boards, or requires more RAM then they have) |
13:53:13 | gokr | The LinkIt One has 4Mb RAM and runs an ARM CPU, so Arduino is not just limited to the small Atmel chips etc. |
13:53:46 | filwit | Okay, so that's the board you're testing with? |
13:53:59 | Araq | gokr: --os:standalone without --gc:none has never been tested. I just remembered :-) |
13:54:08 | gokr | 1-2k sounds very small - most current "small" ones have 32k RAM or similar I would say. |
13:55:37 | Araq | why do you use --os:standalone? does the device lack an OS? how does C++ and malloc work then? |
13:55:40 | filwit | gokr: yeah it's small, but there are a TON of chips out there (especially if you buy from China) that have >1k.. my brother has like 30 boards (literally) of various ranging RAM from ~200 bytes to 1Gb (Intel Edison) |
13:55:56 | * | krux02 joined #nim |
13:56:20 | filwit | gokr: not that you're trying to target all those, just saying.. |
13:59:20 | filwit | Araq: some bare-metal embedded boards use their own C compilers which don't support malloc(), so you have to remake it yourself using sbrk()... that said, it seems gokr is not testing on boards like this, but I think most (if not all) Audrino devices are OS-less |
14:00:03 | gokr | filwit: Yes, I have a LinkIt One, but.... we have most other boards here under the sun. |
14:00:25 | gokr | Araq: standalone... good question. I don't remember :) |
14:00:49 | gokr | Perhaps ... that was the damn issue. |
14:01:59 | gokr | There is no specific reason for the LinkIt - other than the simple fact that it has all communications you want (GSM/GPRS, Wifi, BLE). |
14:03:50 | gokr | Araq: stdlib_system.cpp:8:22: fatal error: sys/mman.h: No such file or directory |
14:04:01 | gokr | (if I drop standalone and enable the gc) |
14:10:37 | * | Arrrr joined #nim |
14:17:12 | Araq | edit alloc.nim and implement osAllocPages via malloc() |
14:18:34 | * | nsf quit (Quit: WeeChat 1.4) |
14:20:44 | * | Arrrr quit (Ping timeout: 276 seconds) |
14:20:44 | * | Arrrrr joined #nim |
14:22:59 | gokr | Ok? :) |
14:24:30 | * | Sornaensis quit (Max SendQ exceeded) |
14:24:46 | * | Sornaensis joined #nim |
14:25:12 | * | Sornaensis quit (Max SendQ exceeded) |
14:25:27 | filwit | gokr: mmap (which is what requires mman.h) does not exist on Audrino and is what Nim's alloc.osAllocPage() uses to allocate memory on the system.. so just replace the mmap() with malloc() and that's all you might need to do to get the GC running.. |
14:25:45 | * | Sornaensis joined #nim |
14:28:46 | gokr | Got it. |
14:32:01 | * | def- quit (Quit: -) |
14:32:21 | Araq | actually you also need to mask the pointer so it's aligned on a page boundary |
14:32:53 | * | def- joined #nim |
14:34:20 | filwit | academic question: why does Nim need the memory to be aligned to a page?.. I understand why it would need a specific page size, but how would the alignment mess anything up? |
14:35:18 | * | filcuc joined #nim |
14:36:07 | filwit | ah.. right cause the GC uses the memory regions + type-bit-pattern to determine if the reference is live in O(1) time... so a mis-aligned memory region might mess that up? |
14:36:46 | filwit | that still doesn't quite make sense to me, but my knowledge of memory management at this level of operating systems is very thin.. |
14:42:13 | coffeepot | accessing unaligned primitives is hugely expensive for the CPU (as it has to fetch both pages) and buggers up atomic read/writes for eg ints. I'd imagine ensuring the memory is aligned to a page ameliorates this somewhat |
14:42:58 | filwit | oh wait, I see.. cause the pointer address would indicate it's offset within the page... so Nim's GC doesn't record some page address offset.. it simply uses the ptr address's page offset + typeDesc bit-pattern to determine if the reference is live |
14:43:04 | coffeepot | * accessing unaligned primatives across page boundaries, I meant |
14:43:28 | filwit | coffeepot: sure, there's the performance concern, but I wasn't thinking about that so much as functionality |
14:44:05 | gokr | Araq: I just removed that staticlib option and it works fine. So ... you can do what you wish with that PR, probably nuke it. |
14:44:31 | Araq | yeah, sorry, but it will only mislead people |
14:44:34 | coffeepot | also if two threads read & write to a misaligned int, they might get 1/2 data from each write |
14:45:51 | gokr | Araq: No, its fine. I ... just find all these different pragmas and their various combinations etc confusing. |
14:48:34 | * | mahasamoot quit (Ping timeout: 240 seconds) |
15:05:04 | * | tt joined #nim |
15:05:27 | * | tt is now known as Guest62289 |
15:07:31 | * | BitPuffin joined #nim |
15:13:33 | * | ga2arch joined #nim |
15:16:37 | ga2arch | hi, i'm using allocShared0 to allocated a ptr to an HashSet[int64], i'm worried about what happens when i insert more elements than it can contains, it should enlarge itself, but is it safe when using allocShared ? |
15:25:24 | * | namra quit (Quit: WeeChat 1.4) |
15:25:45 | * | ga2arch quit (Ping timeout: 252 seconds) |
15:31:14 | * | Guest62289 quit (Quit: Page closed) |
15:38:45 | * | Jesin joined #nim |
15:43:34 | * | nsf joined #nim |
15:46:52 | * | trusion quit (Quit: Leaving) |
15:50:33 | * | endragor quit (Remote host closed the connection) |
15:52:58 | * | gokr quit (Quit: Leaving.) |
16:12:56 | * | mahasamoot joined #nim |
16:21:24 | * | pregressive joined #nim |
16:23:23 | * | skyfex joined #nim |
16:37:56 | * | Arrrr joined #nim |
16:37:56 | * | Arrrrr quit (Ping timeout: 240 seconds) |
16:49:29 | * | skyfex quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
16:51:28 | * | endragor joined #nim |
16:55:20 | * | desophos joined #nim |
16:57:34 | * | endragor quit (Ping timeout: 272 seconds) |
17:05:26 | * | mahasamoot quit (Ping timeout: 256 seconds) |
17:07:24 | * | brson joined #nim |
17:15:18 | ldlework | Varriount: I'm only experienced profiling Python programs. How do I do it in Nim? |
17:17:33 | * | spt joined #nim |
17:18:11 | ldlework | Also I can't find much information on how to mark individual strings as shallow. |
17:20:02 | * | Dildosan quit (Quit: Leaving) |
17:22:03 | spt | Hello all. I want put library .so in directory with compiled nim file. And if I run it - message "could not load .so". Just don't see lib in same folder. |
17:25:32 | * | coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
17:26:09 | * | nsf quit (Quit: WeeChat 1.4) |
17:28:47 | * | filcuc quit (Read error: Connection reset by peer) |
17:30:51 | ldlework | Varriount: Whenever you're around I would love to talk to you about performance. |
17:37:01 | Araq | spt: welcome to Unix. |
17:39:43 | * | ics joined #nim |
17:40:11 | spt | Araq, and how I can use own library? |
17:43:48 | * | spt quit (Quit: Page closed) |
17:48:52 | def- | ldlework: I compile with --profiler:native and use callgrind |
17:50:10 | * | krux02 quit (Quit: Verlassend) |
17:53:31 | * | endragor joined #nim |
17:57:56 | * | endragor quit (Ping timeout: 248 seconds) |
17:58:06 | federico3 | ldlework: look at the profiler docs |
17:58:26 | ldlework | Varriount said I was doing lots of string copying in this snippet: https://gist.github.com/dustinlacewell/a1194610e036434ad888 |
17:58:35 | ldlework | can anyone tell me how I make the strings in this example shallow? |
18:07:46 | filwit | Araq: way to not actually help the guy out and just use his question as an opportunity to complain about Unix when in reality the solution is to simply add a "./" prefix or something to the path.. |
18:08:39 | def- | filwit: yeah, wanted to tell him that as well but the guy was already gone :/ |
18:09:14 | def- | LD_LIBRARY_PATH, in case anyone wonders |
18:15:04 | filwit | def: now you don't have to modify the actual environment PATH.. the solution is much more straight forward (simply add "./" to whatever name you where trying).. There's barely any difference between how Unix does it and how Windows does it |
18:15:07 | filwit | no* |
18:17:32 | Araq | I did help him. it's not a Nim specific problem, it's a Unix problem. |
18:19:47 | filwit | no you didn't.. he asked you directly "how can I..." (obviously he was confused about your response) and you did not give him any more indication as to what you originally meant.. That's not helping someone figure out a problem they're having, more than likely you just gave this guy the message that the community either doesn't care about Unix or doesn't really care to help out people. |
18:21:58 | filwit | I mean, he did just kinda leave quickly after that, and had he stuck around for a bit longer I someone would have answered his questions in more details.. but that might in itself be and indication that he felt your response was too curt and that his question was unwanted. |
18:29:02 | Araq | well I was away afterwards it's not like I wouldn't helped him any further |
18:29:20 | Araq | *wouldn't have helped |
18:30:46 | Araq | and the channel is logged anyway with a bit of luck spt will read what you wrote. |
18:31:48 | filwit | yeah, sorry if my post sounds too accusatory.. I don't mean to get on your case over something silly like this, and I realize it's not like your life revolves around answering questions here or that you shouldn't respond a certain way on your own IRC channel.. |
18:33:16 | * | mahasamoot joined #nim |
18:33:49 | * | endragor joined #nim |
18:36:02 | filwit | bbl |
18:38:22 | * | endragor quit (Ping timeout: 256 seconds) |
18:43:52 | * | yglukhov joined #nim |
18:45:33 | * | Jesin quit (Quit: Leaving) |
18:47:05 | * | Jesin joined #nim |
18:48:52 | * | Matthias247 joined #nim |
18:53:44 | * | darkf joined #nim |
19:08:35 | * | BitPuffin quit (Ping timeout: 240 seconds) |
19:09:45 | * | pregressive quit (Read error: Connection reset by peer) |
19:09:52 | * | pregress_ joined #nim |
19:11:26 | * | yglukhov quit (Remote host closed the connection) |
19:12:47 | * | mahasamoot quit (Ping timeout: 264 seconds) |
19:14:41 | Varriount | ldlework: Strings copy on assignment |
19:16:35 | Varriount | ldlework: So, in your snippet, each the generator is run, a new string is created. |
19:18:36 | Varriount | ldlework: You can mark a string as shallow with the shallow(s: string) procedure. Keep in mind that this causes the string to be unmodifiable. |
19:21:38 | * | Trustable quit (Read error: Connection reset by peer) |
19:24:37 | * | nsf joined #nim |
19:25:08 | * | Trustable joined #nim |
19:25:39 | * | yglukhov joined #nim |
19:29:17 | * | mahasamoot joined #nim |
19:30:05 | * | Trustable quit (Quit: Leaving) |
19:30:15 | * | Trustable joined #nim |
19:45:26 | * | BitPuffin joined #nim |
19:55:08 | yglukhov | hi all. tricky question. i've got a nakefile which is normally compiled by nake in a mode without any optimizations, because it doesnt really make a lot of sense to optimize anything in a nakefile. now i want to call some really cpu intensive stuff from a nakefile. can i import a module somehow and say it should always be "imported" with maximum optimization/no checks/etc? |
19:57:20 | * | yglukhov quit (Remote host closed the connection) |
20:04:44 | * | BitPuffin quit (Read error: Connection reset by peer) |
20:06:18 | * | mahasamoot quit (Ping timeout: 272 seconds) |
20:12:08 | * | mahasamoot joined #nim |
20:13:41 | * | mat4 joined #nim |
20:13:48 | mat4 | hello |
20:14:01 | Arrrr | hi |
20:14:04 | * | Arrrr quit (Quit: WeeChat 1.2) |
20:14:17 | mat4 | hi Arrrr |
20:19:32 | * | mahasamoot quit (Ping timeout: 276 seconds) |
20:31:54 | * | yglukhov joined #nim |
20:38:27 | * | gokr joined #nim |
20:40:31 | * | mahasamoot joined #nim |
20:47:49 | * | filcuc joined #nim |
20:51:40 | * | gokr quit (Read error: Connection reset by peer) |
20:51:56 | * | gokr joined #nim |
20:54:22 | * | mahasamoot quit (Ping timeout: 256 seconds) |
21:01:10 | mat4 | hi gokr |
21:01:19 | gokr | hey :) |
21:01:45 | mat4 | just see you uploaded your Arduino wrapper, nice work |
21:02:02 | gokr | Yeah, I am... rigging a Vagrantfile right now so that you can easily get going. |
21:02:29 | gokr | Hoping to coax Andreas into helping out with alloc.nim - to make it use malloc instead of mmap. |
21:02:33 | gokr | :) |
21:05:12 | mat4 | please take in mind, that the target MCU probably differentiate between data and Flash memory which likely mean there exist more than one malloc variant |
21:05:45 | * | ga2arch joined #nim |
21:06:06 | ga2arch | hi, how i do i create a Table[int64, int64] on the shared heap using the boehm gc ? |
21:06:57 | gokr | mat4: ok |
21:07:44 | gokr | ga2arch: What has the GC to do with it? (or am I missing something) |
21:08:22 | mat4 | I don't think the GC is relevant for this task |
21:08:51 | ga2arch | gokr: i have to share the table with two threads, so i opted for the boehm to not have to deal with manual memory management |
21:09:50 | ga2arch | but if i create it like i normally would and then spawn the thread the compiler tells me, Error: 'spawn' takes a GC safe call expression |
21:10:14 | dom96 | ga2arch: You might want to consider using this module: https://github.com/nim-lang/Nim/blob/devel/lib/pure/collections/sharedtables.nim |
21:10:20 | dom96 | Although beware it is very new |
21:11:21 | ga2arch | that looks cool thanks, but i'm trying to understand the meaning of that message and nim in general |
21:11:23 | * | Varriount quit (Disconnected by services) |
21:11:23 | * | Varriount_ joined #nim |
21:13:01 | dom96 | ga2arch: You cannot access a GC'd global variable from another thread. If you do then your procedure is not GC safe. |
21:13:12 | * | mahasamoot joined #nim |
21:13:13 | gokr | ga2arch: Just wondering what Boehm specifically has to do with it. |
21:13:33 | gokr | Does it behave in some specific way that differs from the normal GC? |
21:13:41 | dom96 | By "GC'd" I mean "garbage collected", that includes types whose memory is managed by the GC such as string and seq. |
21:14:52 | dom96 | gokr: I think that Boehm supports shared GC'd memory. |
21:15:11 | gokr | dom96: Ok, interesting. |
21:15:13 | mat4 | ga2arch: If I remeber it correctly, there exist a pragma for excluding definations to be GC'd |
21:15:18 | dom96 | Even if that is the case, I'm not sure if Nim will allow it. |
21:15:36 | dom96 | ga2arch: You could try turning off the thread safety analysis using the --threadAnalysis:off flag |
21:15:58 | gokr | ga2arch: Another idea is to let one thread own the table - and let the other threads talk to it in order to add/delete/read etc. |
21:16:47 | ga2arch | gokr: i know but for the use of case i have right now it's overkill to use message passing |
21:16:55 | ga2arch | dom96: gonna try that flag |
21:17:19 | dom96 | ga2arch: keep in mind that your program may crash then |
21:17:44 | ga2arch | dom96: with the flag off it works |
21:17:45 | mat4 | if so, why not simply use cooperate multitasking ? |
21:18:17 | ga2arch | mat4: what do you have in mind ? |
21:20:17 | gokr | dom96: That shared table looks simple and neat. |
21:20:42 | dom96 | gokr: Araq wrote it so that async can use it |
21:20:53 | mat4 | just implement your threads as 'coroutines'. This way all ressources are naturally shared and because such 'threads' control task switches there exist no possible access conflict |
21:23:09 | ldlework | mat4: +1 |
21:23:18 | ga2arch | mat4: yes, i could that but it's still way more complex than a simple hashtable + lock, i'm not really looking into doing anything fancy, boehm gc + couple of locks |
21:23:23 | ldlework | Twisted is my favorite networking library. |
21:26:20 | * | wuehlmaus quit (Quit: Lost terminal) |
21:26:43 | * | nsf quit (Quit: WeeChat 1.4) |
21:27:13 | ga2arch | it doesn't feel right to disable threadAnalysis, what exactly does that flag do ? |
21:27:17 | ga2arch | the manual says "GC-safety checking" .. but in what ways ? |
21:32:59 | gokr | AFAIK it verifies that no shared memory is reachable via global variables etc. |
21:33:52 | gokr | The obvious case being two threads both accessing a module level variable, thus stomping all over themselves. ;) |
21:42:57 | Varriount_ | ldlework: How are the tiles going? |
21:43:02 | * | Varriount_ is now known as Varriount |
21:43:04 | ldlework | Varriount_: been working |
21:43:12 | ldlework | I mean at my job |
21:43:54 | mat4 | ga2arch: sorry, found no progra for this |
21:44:00 | mat4 | ^pragma |
21:44:15 | ga2arch | mat4: i was looking for it too, too bad, thanks anyways |
21:44:22 | Varriount | ga2arch: You should be able to turn off thread analysis via a pragma as well. I don't know if you can do it on a module-level basis though. |
21:51:48 | * | Demon_Fox joined #nim |
21:53:56 | ga2arch | how can i correctly allocate and initialize a Table on the shared heap, with createShared / allocShared0 ? |
21:54:46 | * | mahasamoot quit (Ping timeout: 240 seconds) |
21:56:26 | * | mahasamoot joined #nim |
21:58:43 | Varriount | ga2arch: Well, you can have the table object on the shared heap, but that won't do much. The table's data is stored in a sequence member. |
21:59:06 | ga2arch | that's what i was worried about |
21:59:11 | ga2arch | looking at the source code |
22:00:27 | Varriount | ga2arch: You could always fork+modify the source. |
22:02:06 | Varriount | ga2arch: However, I don't know if that will matter, since you're using the boehm gc? |
22:02:42 | Varriount | I mean, you should just be able to use a sequence from another thread - no need to allocate it on the shared heap. |
22:03:17 | ga2arch | Varriount: let me write a simple snippet about what i'm trying to do, because it's getting confusing |
22:06:27 | * | gokr left #nim (#nim) |
22:07:35 | ga2arch | Varriount: http://pastebin.com/vtt157MX |
22:08:18 | ga2arch | Varriount: snippet.nim(19, 13) Error: 'spawn' takes a GC safe call expression |
22:08:55 | ga2arch | Varriount: and i understand the error, but how can i fix my code ? |
22:09:22 | * | mahasamoot quit (Ping timeout: 240 seconds) |
22:12:30 | * | gokr joined #nim |
22:13:29 | * | BitPuffin|osx joined #nim |
22:23:54 | Varriount | ga2arch: Uh, spawn is generally only meant for GC-correct stuff, if I recall correctly. |
22:26:48 | Varriount | ga2arch: Adding the 'gcsafe' pragma to test along with turning thread analysis off makes the program compile. |
22:27:11 | ga2arch | yes, without threadAnalysis it works |
22:27:20 | ga2arch | doesn't seem right tho |
22:29:28 | Varriount | ga2arch: Have you considered passing a table to the procedure, rather than using a global? |
22:31:04 | ga2arch | Varriount: yes, but in the program i'm developing i need to use the table from two different threads, so i can't pass it by value and by ref would not make things different i think(?) ? |
22:32:55 | * | Dildosan joined #nim |
22:33:47 | Varriount | ga2arch: Sorry for yet another question, but is there a reason you're using spawn instead of a basic thread? http://nim-lang.org/docs/threads.html |
22:35:32 | ga2arch | Varriount: thought it was something akin to Haskell's forkIO |
22:36:11 | Varriount | Well, spawn is for high level parallelism, not for manual stuff. Still, there should be a way to get this working... |
22:40:04 | ephja | http://nim-lang.org/docs/channels.html |
22:40:28 | Varriount | ga2arch: Here is your secret, magical solution: https://gist.github.com/Varriount/b67a264a7139c900ba65 |
22:42:17 | Varriount | ga2arch: Spawn parameters need to be raw pointers if they are going to be mutated. |
22:43:23 | * | filcuc quit (Read error: Connection reset by peer) |
22:43:29 | ga2arch | Varriount: i see, thanks a lot :) ... is this safe by any means ? |
22:44:01 | ga2arch | as safe i mean, it's correctly GC'ed nd stuff ? |
22:44:13 | Varriount | ga2arch: No idea. The extent of my threading experience has been mainly with Python (and some Java). |
22:44:50 | Varriount | ga2arch: I think so though, as long as you don't modify the table to contain GC'd types, like strings. |
22:45:11 | Varriount | Though, again, use of the boehm gc should sort that problem out. |
22:46:08 | ga2arch | i think probably the correct way to implement this "nim style" would be with a "store" thread and use channel to add del and retrieve stuff from the hashtable |
22:46:21 | ga2arch | seems so much work for something so simple tho |
22:47:13 | Varriount | ga2arch: Well, something to keep in mind is that however simple various abstractions make something seem, there's usually a whole lot going on behind the scenes. |
22:47:52 | * | mat4 quit (Quit: Verlassend) |
22:48:10 | Varriount | ga2arch: If you want, use `objdump -d` and look at your function calls. |
22:48:18 | ga2arch | Varriount: kinda scares me, because a lot of doc is missing, i should probably go read the source code to understand it better |
22:48:29 | ga2arch | ah right, didn't think about it |
22:48:34 | Varriount | ga2arch: What documentation is missing? |
22:48:46 | ga2arch | i mean about the internals |
22:49:35 | ga2arch | how stuff is implemented, like spawn for example, it's not really clear that it just offload a task to a thread in the threadpool |
22:49:38 | Varriount | ga2arch: I'd start with the more complicated parts of the standard library before diving into the compiler. Try looking at some of the stuff in lib/system |
22:50:52 | ga2arch | Varriount: will do :) |
23:01:21 | * | Demon_Fox quit (Quit: Leaving) |
23:10:07 | Varriount | By the way, is anyone actually submitting anything to Hacker News? I haven't seen anything Nim-related on there in a while... |
23:11:27 | * | nsf joined #nim |
23:18:11 | Varriount | Hello nsf |
23:18:21 | nsf | hello |
23:20:37 | * | shodan45 joined #nim |
23:20:55 | * | yglukhov quit (Remote host closed the connection) |
23:21:11 | * | gokr quit (Quit: Leaving.) |
23:28:37 | * | ga2arch quit (Quit: Page closed) |
23:50:37 | * | saml quit (Quit: Leaving) |