00:01:38 | * | bozaloshtsh quit (Ping timeout: 244 seconds) |
00:06:22 | * | yglukhov joined #nim |
00:10:33 | * | yglukhov quit (Ping timeout: 240 seconds) |
00:33:11 | * | libman quit (Remote host closed the connection) |
00:37:57 | * | enthus1ast quit (Read error: Connection reset by peer) |
00:38:49 | * | enthus1ast joined #nim |
00:42:50 | * | yglukhov joined #nim |
00:47:57 | * | yglukhov quit (Ping timeout: 276 seconds) |
01:04:00 | * | GangstaCat quit (Quit: Leaving) |
01:19:11 | * | yglukhov joined #nim |
01:19:31 | * | GangstaCat joined #nim |
01:23:13 | * | bozaloshtsh joined #nim |
01:23:51 | * | yglukhov quit (Ping timeout: 265 seconds) |
01:39:24 | * | vendethiel quit (Ping timeout: 250 seconds) |
01:39:33 | * | vendethiel joined #nim |
01:43:26 | * | yglukhov joined #nim |
01:44:11 | * | brson quit (Quit: leaving) |
01:48:24 | * | yglukhov quit (Ping timeout: 276 seconds) |
02:19:29 | * | yglukhov joined #nim |
02:24:09 | * | yglukhov quit (Ping timeout: 276 seconds) |
02:55:39 | * | yglukhov joined #nim |
03:00:33 | * | yglukhov quit (Ping timeout: 276 seconds) |
03:20:04 | * | yglukhov joined #nim |
03:24:27 | * | yglukhov quit (Ping timeout: 260 seconds) |
03:52:52 | * | perturbation joined #nim |
03:56:22 | * | yglukhov joined #nim |
03:57:02 | perturbation | anyone else using Nim for machine learning / data science type tasks? |
03:57:27 | perturbation | read through http://rnduja.github.io/2015/10/21/scientific-nim/ and am using the linalg library on a small-scale project |
03:58:59 | perturbation | but would be great if there are other libraries out there that I've overlooked ;) |
03:59:23 | perturbation | I saw there's a libsvm wrapper in the stdlib but haven't had a chance to play with it yet |
04:00:30 | * | yglukhov quit (Ping timeout: 246 seconds) |
04:31:42 | * | brson joined #nim |
04:32:37 | * | yglukhov joined #nim |
04:37:24 | * | yglukhov quit (Ping timeout: 276 seconds) |
04:56:56 | * | yglukhov joined #nim |
04:58:44 | * | silven quit (Ping timeout: 250 seconds) |
04:59:57 | * | silven joined #nim |
05:01:17 | * | yglukhov quit (Ping timeout: 260 seconds) |
05:05:54 | tautologico | perturbation: I'm new to nim, but thanks for the link, it's right up my alley |
05:06:29 | perturbation | :) |
05:06:54 | * | GangstaCat quit (Ping timeout: 260 seconds) |
05:07:39 | tautologico | I may have interest in doing machine learning and related stuff in nim, still evaluating |
05:08:04 | tautologico | for data analysis I think a good dataframe library is very convenient |
05:15:46 | perturbation | agreed - I really miss data.table from R |
05:19:57 | * | GangstaCat joined #nim |
05:35:44 | * | perturbation quit () |
05:45:06 | * | endragor joined #nim |
05:56:57 | * | gokr joined #nim |
05:58:36 | * | vendethiel- joined #nim |
05:58:39 | * | vendethiel quit (Ping timeout: 244 seconds) |
06:00:25 | * | zaquest quit (Quit: Leaving) |
06:16:06 | * | bozaloshtsh quit (Changing host) |
06:16:06 | * | bozaloshtsh joined #nim |
06:17:28 | * | endragor_ joined #nim |
06:20:37 | * | endragor quit (Ping timeout: 260 seconds) |
06:21:34 | * | kier quit (Ping timeout: 252 seconds) |
06:23:25 | * | kier joined #nim |
06:32:39 | * | endragor_ quit (Remote host closed the connection) |
06:33:18 | * | endragor joined #nim |
06:33:56 | * | brson quit (Ping timeout: 276 seconds) |
06:40:35 | * | brson joined #nim |
06:41:13 | * | gokr left #nim (#nim) |
06:44:23 | * | mahlon quit (Read error: Connection reset by peer) |
06:46:01 | * | mahlon joined #nim |
06:48:35 | * | yglukhov joined #nim |
06:53:51 | * | jackv quit (Ping timeout: 264 seconds) |
06:57:20 | * | Jesin quit (Ping timeout: 276 seconds) |
06:58:25 | * | jackv joined #nim |
07:06:55 | * | Jesin joined #nim |
07:58:39 | * | Trustable joined #nim |
08:35:38 | * | Arrrr joined #nim |
08:45:36 | * | PMunch joined #nim |
09:00:00 | * | brson quit (Ping timeout: 244 seconds) |
09:06:35 | * | Demon_Fox quit (Quit: Leaving) |
09:08:10 | * | brson joined #nim |
09:20:19 | * | enthus1ast quit (Ping timeout: 252 seconds) |
09:26:07 | yglukhov | dom96: hey, found the issue, i mentioned yesterday. the problem is WSArecv |
09:29:59 | * | brson quit (Ping timeout: 260 seconds) |
09:32:40 | * | arnetheduck joined #nim |
09:37:42 | * | brson joined #nim |
09:54:58 | cheatfate | yglukhov, interesting |
09:55:20 | cheatfate | problem in windows api function? :) |
09:55:29 | yglukhov | in its usage |
09:55:41 | yglukhov | are you an expert in winsocks by any chance? =) |
09:55:50 | cheatfate | explain |
09:56:14 | cheatfate | yglukhov, lets found your bug |
09:56:21 | cheatfate | find* |
09:57:06 | yglukhov | https://github.com/nim-lang/Nim/blob/devel/lib/pure/asyncdispatch.nim#L767 |
09:57:22 | yglukhov | wsasend may return 0 and bytesReceived == 0 |
09:57:44 | cheatfate | you mean wsarecv |
09:57:50 | yglukhov | in such case setting realSize to size is extremely wrong. |
09:58:03 | yglukhov | yeah, wsarecv |
09:58:39 | yglukhov | so i fixed it by not calling complete in case of bytesReceived == 0 |
09:59:10 | yglukhov | in such way, socket completion handler will later be called with nice values, and complete the future |
09:59:40 | cheatfate | yglukhov, you are right this is weird part of code... |
09:59:47 | yglukhov | but, msdn says, that it is recommended to pass NULL instead of bytesReceived in case of overlapped socket |
09:59:53 | cheatfate | but i never fall to this branch |
10:00:44 | yglukhov | we can reproduce it by sending around 10000 requests to mongo in a row. |
10:01:09 | yglukhov | under "normal" load it doesnt reproduce |
10:02:02 | cheatfate | If an overlapped operation completes immediately, WSARecv returns a value of zero and the lpNumberOfBytesRecvd parameter is updated with the number of bytes received and the flag bits indicated by the lpFlags parameter are also updated. |
10:02:42 | cheatfate | Overlapped Socket I/O |
10:02:42 | cheatfate | If an overlapped operation completes immediately, WSARecv returns a value of zero and the lpNumberOfBytesRecvd parameter is updated with the number of bytes received and the flag bits indicated by the lpFlags parameter are also updated. |
10:03:28 | cheatfate | there many texts in wsarecv documentation which are contradict each other |
10:04:37 | cheatfate | and there 2 types of overlapped io can be used... overlapped with event and overlapped without event... asyncdispatch uses overlapped without event |
10:06:25 | cheatfate | i think simple usage of lpNumberOfBytesRecvd result could be ok but needs testing |
10:06:52 | cheatfate | and we always can just delete this branch because completion routine will be called anyway |
10:09:41 | cheatfate | yglukhov, try to test it with simple usage of bytesReceived |
10:12:33 | * | brson quit (Ping timeout: 240 seconds) |
10:14:14 | cheatfate | and i think when wsarecv returns 0 and bytesReceived == 0 then peer was disconnected... |
10:19:18 | * | ephja joined #nim |
10:29:54 | * | brson joined #nim |
10:30:09 | * | brson quit (Read error: Connection reset by peer) |
10:30:37 | dom96 | yglukhov: Glad you found the problem. Think you could create a PR with the fix? :) |
10:32:00 | dom96 | Sucks that there are edge cases like this, I remember not being sure what to do in that case but whatever way I reproduced it must have been slightly different again. |
10:35:18 | * | elrood joined #nim |
10:39:37 | yglukhov | dom96: also there seems to be a lot of extra copying. what do you think if we preallocate the result string with `size`, and put it into the Future immediately, and init buf for wsarecv with addr to it? |
10:40:15 | dom96 | that should be fine |
10:44:56 | * | gokr joined #nim |
10:45:33 | * | coffeepot joined #nim |
10:49:03 | * | federico3 quit (Quit: WeeChat 1.1.1) |
10:49:40 | * | federico3 joined #nim |
10:52:17 | coffeepot | hey guys, just wondering will the GitHub pricing changes affect Nim? |
10:54:19 | Arrrr | Isn't that for private repos? |
10:55:12 | coffeepot | yes I think so, so no then? :) |
10:58:26 | dom96 | nope |
10:58:53 | coffeepot | \o/ |
10:59:50 | coffeepot | btw dom96, been reading your book. Fantastic stuff! Really looking forward to the metaprogramming chapter, but well done on achieving so much already on it |
11:00:59 | * | federico3 quit (Quit: WeeChat 1.1.1) |
11:03:17 | * | federico3 joined #nim |
11:11:00 | dom96 | coffeepot: Thanks :) |
11:16:09 | * | BitPuffin joined #nim |
11:22:00 | * | MyMind joined #nim |
11:24:29 | * | sembei quit (Ping timeout: 276 seconds) |
11:25:42 | * | BitPuffin quit (Ping timeout: 244 seconds) |
11:27:22 | * | enthus1ast joined #nim |
12:49:00 | * | fastrom joined #nim |
13:08:11 | * | fastrom quit (Quit: Leaving.) |
13:17:28 | * | brson joined #nim |
13:20:59 | * | GangstaCat quit (Ping timeout: 260 seconds) |
13:21:19 | * | brson quit (Client Quit) |
13:21:35 | * | brson joined #nim |
13:26:41 | * | nsf quit (Ping timeout: 276 seconds) |
13:26:43 | * | GangstaCat joined #nim |
13:54:18 | * | vendethiel joined #nim |
13:55:19 | * | vendethiel- quit (Ping timeout: 252 seconds) |
14:04:57 | * | aziz_ joined #nim |
14:13:11 | cheatfate | yglukhov, you are not fully right when "but, msdn says, that it is recommended to pass NULL instead of bytesReceived in case of overlapped socket", i checked source code of libuv and python's async code and they are using bytesReceived when WSARecv returned 0 |
14:33:49 | dom96 | I just tried to sell #hedgewars on Nim |
14:34:15 | dom96 | It's currently written in Pascal and they want to rewrite it in Rust (or Ada) |
14:34:38 | dom96 | They rejected it based on: 1) indentation for blocks 2) GC :( |
14:34:50 | cheatfate | yglukhov, of course your variant would work, but it just makes async code a little bit slower |
14:37:51 | ldleworker | dom96: *rolls eyes* |
14:39:06 | cheatfate | dom96, looks like nobody likes GC |
14:39:39 | dom96 | Yeah... well, I tried :\ |
14:39:52 | endragor | paranoids |
14:40:56 | cheatfate | endragor, paranoids because they dont like GC? |
14:41:14 | endragor | yes |
14:41:54 | cheatfate | endragor, hmm, i dont like GC too |
14:43:07 | endragor | GC_disable() is the friend of paranoids :) |
14:43:14 | cheatfate | GC just adds some kind of uncontrollable entity to your projects... |
14:43:22 | cheatfate | GC_disable() = discard i think |
14:43:28 | endragor | --gc:none actually |
14:44:12 | endragor | cheatfate: it's not |
14:44:14 | cheatfate | endragor, then you need to make stdlib again... |
14:44:38 | endragor | GC_disable() + GC_step() works well for me |
14:44:42 | dom96 | no need to be afraid of the GC |
14:44:46 | dom96 | it's soft real-time |
14:44:53 | dom96 | i.e. perfect for games |
14:44:55 | endragor | right |
14:45:14 | cheatfate | endragor, when i made stress tests of asynchttpserver.nim i really dont understand why `wrk` returns such big deviation of results |
14:45:43 | * | pregressive joined #nim |
14:46:10 | cheatfate | endragor, when you run C code you will not get results like 0.1ms +/- 10ms |
14:46:33 | dom96 | cheatfate: have you tried with --gc:none? |
14:46:47 | dom96 | to see if the deviation disappears? |
14:48:12 | cheatfate | dom96, i dont think deviation will disappears just because there will be no memory deallocation so processing of requests will just increasing... |
14:48:49 | dom96 | cheatfate: Aren't you blaming the deviation on the GC? |
14:49:06 | cheatfate | yeah i think GC makes deviation |
14:49:16 | endragor | cheatfate: Nim provides enough tools to control that. Just use soft realtime guarantees as mentioned above. the place from which GC is called matters a lot - the deeper the stack is, the longer the scan takes |
14:49:26 | dom96 | yeah, so to test if you're right, disable the GC and see if the deviation disappears |
14:49:32 | dom96 | if it does then you're right |
14:50:29 | * | libman joined #nim |
14:50:39 | cheatfate | dom96, if i disable GC it will just allocates memory all the time without deallocation... on stresss tests OS starts to swapping my memory pages... so deviation will increased too |
14:51:14 | dom96 | cheatfate: I see. Thought it wouldn't allocate that much memory. |
14:52:01 | cheatfate | dom96, SIGSEGV: Illegal storage access. (Attempt to read from nil?) this is result of --gc:none |
14:53:09 | dom96 | pity |
14:53:12 | cheatfate | dom96, https://gist.github.com/cheatfate/9cf957d08d29e3c319c54ce97c6212d1 |
14:53:37 | dom96 | and also strange |
14:55:57 | cheatfate | it will be very good if "--gc:none" will start to work, |
14:58:11 | endragor | try GC_disable(), too. It will still count references, but won't collect garbage periodically |
14:58:16 | * | novavis joined #nim |
15:01:45 | yglukhov | cheatfate: could you share a link to some python/libuv code where they process wsarecv? |
15:03:02 | yglukhov | We have to ensure that the buffer is empty because WSARecv will tell us immediately when it was disconnected, even when there is still data in the buffer |
15:03:08 | yglukhov | dom96: Are you really sure about this? |
15:03:46 | cheatfate | yglukhov, https://github.com/libuv/libuv/blob/b12624c13693c4d29ca84b3556eadc9e9c0936a4/src/win/tcp.c#L520 |
15:03:54 | dom96 | yglukhov: maybe create two separate PRs, I'm not sure but would like to see what you have in mind to make a decision. |
15:04:13 | * | brson quit (Read error: Connection reset by peer) |
15:04:24 | * | aziz_ quit (Remote host closed the connection) |
15:04:28 | yglukhov | tbh, i'm a bit lost. havent found the best solution yet |
15:08:21 | cheatfate | yglukhov, could you please just test with `realSize = bytesReceived` |
15:11:32 | cheatfate | yglukhov, could you please test this variant: https://gist.github.com/cheatfate/373b7f9b03aa29f60c81e2fce8f38c1b/revisions |
15:14:01 | * | brson joined #nim |
15:14:36 | * | wuehlmaus quit (Quit: Lost terminal) |
15:20:07 | yglukhov | cheatfate: completing future when bytesReceived == 0 doesn't work for me. i've already tested it sometime ago. |
15:21:16 | yglukhov | it actually can't work if you think of it. future.complete(0) will be firther treated as eof by higher-level api |
15:21:26 | yglukhov | * further |
15:23:44 | yglukhov | the best solution i currently came up with is not completing future in case when bytesReceived == 0. it works. deletion of all the code that handles res == 0 and fully relying on the completion handler also works, but as you say it might be less effective |
15:23:54 | yglukhov | * efficient |
15:25:24 | dom96 | yglukhov: that sounds like a good solution |
15:25:25 | cheatfate | yglukhov, if it not works, then you are right and we can't use bytesReceived when WSARecv returned 0 |
15:26:53 | yglukhov | cheatfate: you mean ((when WSARecv returned 0) and (when bytesReceived == 0))? |
15:27:19 | cheatfate | yglukhov, wait i will patch my gist properly |
15:27:28 | yglukhov | kk, afk 10 min |
15:34:08 | * | Jesin quit (Quit: Leaving) |
15:40:01 | cheatfate | yglukhov, could you please point me exact branch which you are suspect? |
15:40:26 | * | pecan joined #nim |
15:41:47 | dom96 | cheatfate: I think he mentioned https://github.com/nim-lang/Nim/blob/devel/lib/pure/asyncdispatch.nim#L767 this morning |
15:42:41 | cheatfate | dom96, in my stress tests of asynchttpserver.nim on windows this works fine and causes deep recursion problems |
15:43:29 | yglukhov | cheatfate: do you enter this specific line with bytesReceived == 0? |
15:44:08 | yglukhov | "From my tests bytesReceived isn't reliable", dom96, is this your comment? |
15:44:19 | dom96 | yglukhov: yep |
15:44:40 | yglukhov | is it unreliable in the same way im talking about? |
15:44:42 | cheatfate | yglukhov, https://github.com/nim-lang/Nim/blob/devel/lib/pure/asyncdispatch.nim#L759 this line causes problem? |
15:45:13 | cheatfate | because in this branch i dont like only "and dataBuf.buf[0] == '\0'" |
15:45:20 | dom96 | yglukhov: I recall that it gave 0 sometimes when data was actually received. |
15:45:59 | dom96 | is that what's happening in your case? |
15:46:09 | yglukhov | dom96: yep. |
15:46:14 | yglukhov | cheatfate: nope. |
15:46:24 | yglukhov | cheatfate: https://github.com/nim-lang/Nim/blob/devel/lib/pure/asyncdispatch.nim#L767 |
15:47:17 | yglukhov | nimongo uses buffered async sockets, and the buffer is not zeroed before reading. so the buffer[0] == 0 check might not work in this case |
15:48:00 | dom96 | yglukhov: but I guess `size` isn't the amount that is received either? |
15:48:27 | yglukhov | dom96, no, of course. |
15:49:15 | yglukhov | actually, i also don't like the "and dataBuf.buf[0] == '\0'". looks really hacky. |
15:49:15 | dom96 | ahh, but then you get the real amount that is received from IOCP? |
15:49:21 | yglukhov | yup |
15:50:16 | * | fastrom joined #nim |
15:50:50 | cheatfate | i think we just need to remove " and dataBuf.buf[0] == '\0'": |
15:51:05 | cheatfate | and then we can do realSize = bytesReceived |
15:51:11 | yglukhov | dom96, cheatfate i would vote for removing all of this branch. what do you say? |
15:51:53 | yglukhov | and leave the last branch, and only complete the future when bytesReceived != 0 |
15:52:54 | yglukhov | the only question i still havent understood is dom96's comment |
15:53:00 | yglukhov | We have to ensure that the buffer is empty because WSARecv will tell |
15:53:05 | yglukhov | us immediately when it was disconnected, even when there is still |
15:53:10 | yglukhov | data in the buffer. |
15:53:19 | cheatfate | yglukhov, if you remove all "immediate completion" branch you will hide another bug with "deep recursion" |
15:53:33 | * | kulelu88 joined #nim |
15:53:49 | yglukhov | cheatfate, no, immediate completion will still be there when bytesReceived > 0 |
15:54:17 | cheatfate | i think we just need to remove only " and dataBuf.buf[0] == '\0'" |
15:55:09 | yglukhov | cheatfate, no, because we can't complete when bytesReceived == 0, because it is __unreliable__ |
15:55:39 | yglukhov | ok, let me do the pr |
15:56:49 | * | cheatfate quit (Quit: Leaving) |
15:57:09 | * | cheatfate joined #nim |
15:59:24 | dom96 | hrm |
16:00:31 | cheatfate | dom96, i think we need to add one more check |
16:00:36 | dom96 | but then if you remove that branch what will happen if socket is disconnected? |
16:00:57 | yglukhov | btw, proc recv looks a lot like it could reuse proc recvInto |
16:01:23 | dom96 | I guess the future will simply be completed with 0 later? |
16:01:33 | cheatfate | dom96, wait guys |
16:01:37 | yglukhov | dom96: in case of disconnection the future will be completed with the handler |
16:01:54 | cheatfate | OVERLAPPED structure has a member which can be checked if operation really completed |
16:02:39 | * | coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
16:02:40 | cheatfate | there is a macro https://msdn.microsoft.com/en-us/library/windows/desktop/ms683244(v=vs.85).aspx |
16:05:09 | cheatfate | from my tests i can say |
16:05:41 | cheatfate | in some cases OVERLAPPED.Internal still STATUS_PENDING |
16:05:57 | yglukhov | do you suggest checking for HasOverlappedIoCompleted when wsarecv returns 0? |
16:06:01 | cheatfate | i think in such cases bytesReceived is unreliable |
16:06:21 | cheatfate | yep |
16:06:35 | dom96 | msdn docs say that when `WSARecv` returns 0 the "operation completed immediately" |
16:06:37 | yglukhov | do you mean that your tests produce STATUS_PENDING when wsarecv returns 0? |
16:06:45 | cheatfate | yglukhov, yep |
16:06:51 | dom96 | so won't that check be redundant? |
16:07:19 | cheatfate | dom96, we are using OVERLAPPED structure without CreateEvent for hEvent member |
16:07:21 | yglukhov | cheatfate: does it produce STATUS_PENDING *every time* when wsarecv returns 0? |
16:07:57 | cheatfate | yglukhov, i dont sure maybe it always STATUS_PENDING |
16:07:58 | yglukhov | cheatfate: can you corellate STATUS_PENDING with bytesReceived? |
16:08:57 | cheatfate | yglukhov, please look here https://github.com/libuv/libuv/blob/b12624c13693c4d29ca84b3556eadc9e9c0936a4/src/win/tcp.c#L534 |
16:09:36 | cheatfate | yglukhov, authors of libuv for some reason using registerwaitforsingleobject with postqueuedcompletionstatus |
16:10:51 | cheatfate | yglukhov, they try to do manual call |
16:10:58 | cheatfate | yglukhov, and this is wrong too |
16:12:19 | yglukhov | cheatfate: so.. do you have a suggestion? |
16:13:03 | cheatfate | i want to check STATUS_PENDING of OVERLAPPED.Internal member like HasOverlappedIoCompleted |
16:13:31 | cheatfate | and if OVERLAPPED.Internal != STATUS_PENDING: i think to use bytesReceived |
16:13:57 | yglukhov | ok, can you confirm that you dont get STATUS_PENDING *every* time wsarecv returns 0. because if you do, then it doesnt make much sense |
16:14:36 | cheatfate | yglukhov, you need to make tests too, i will make asynchttpserver stress tests and you can make nimongo tests |
16:15:00 | cheatfate | to check if ol.Internal != STATUS_PENDING |
16:15:06 | dom96 | This snippet from the MSDN docs: https://gist.github.com/dom96/e8eb03b4338d06e3dbc5b917e5a5328b |
16:15:25 | dom96 | Seems to indicate that when WSARecv returns 0 and bytesReceived is 0 that the socket disconnected. |
16:15:31 | yglukhov | i'll try. unfortunately it's not that easy, because i don't have windows, and have to bother another guy :( |
16:16:25 | yglukhov | dom96, commented on your gist ;) |
16:17:15 | yglukhov | msdn is like a book of laws. go try interpret :D |
16:17:55 | dom96 | so according to that we shouldn't be using `bytesReceived` at all? |
16:18:10 | dom96 | "Use NULL for this parameter if the lpOverlapped parameter is not NULL to avoid potentially erroneous results." |
16:18:11 | dom96 | D: |
16:19:26 | dom96 | if that's the case then maybe we should just let the completion handler handle the case when WSARecv returns 0? |
16:19:28 | yglukhov | thats what i said previously, but cheatfate insists it would not be as efficient. and from my observations (and from yours either) the only erroneous result i've met is 0. |
16:20:15 | dom96 | I say go for it. |
16:20:29 | dom96 | If we can demonstrate that it's significantly slower then we can always revert back and think of a better solution |
16:20:47 | yglukhov | cheatfate, please agree ;) |
16:20:51 | dom96 | it's better to be correct and possibly slower than be faster but incorrect. |
16:21:04 | * | PMunch quit (Ping timeout: 252 seconds) |
16:24:21 | cheatfate | heh, you guyst just to lazy to make some tests i think |
16:24:23 | cheatfate | :) |
16:24:29 | dom96 | as for reusing recvInto, I think that's a good idea. |
16:26:56 | cheatfate | and when you move "immediate completion" out, you will hide "deep recursion" bug which must be resolved too |
16:32:20 | dom96 | That won't hide it, it will remove it, no? |
16:36:12 | yglukhov | cheatfate: so how about your test? |
16:37:14 | cheatfate | yglukhov, https://gist.github.com/cheatfate/a9e1a258a72ec29e11a415d5917ef4c9 |
16:38:35 | cheatfate | my tests in stress test of asynchttpserver.nim gives me that in 217425 requests there was 9 messages "complete with bytesReceived != 0" |
16:39:04 | cheatfate | please try my variant of asynchttpserver |
16:39:16 | cheatfate | not asynchttpserver but asyncdispatch |
16:40:19 | yglukhov | cheatfate: with 9 out of 217425 you will get what you're afraid of. |
16:40:58 | yglukhov | that is too much deferred completion |
16:42:33 | cheatfate | yglukhov, could you please test my asyncdispatch with nimongo? |
16:42:58 | yglukhov | yes, please wait a bit |
16:44:06 | yglukhov | wow, you're from Kyiv! |
16:44:24 | yglukhov | have you been to our Nim workshop? |
16:45:22 | cheatfate | yglukhov, i missed it |
16:45:53 | yglukhov | ah, pity. i guess we're gonna do another one, this fall. |
16:46:10 | cheatfate | yglukhov, next one i will not miss :) |
16:46:23 | yglukhov | but keep it a secret please, don't tell anyone ;) |
16:46:51 | cheatfate | yglukhov, ok |
16:47:38 | yglukhov | can you try my gist meanwhile please? https://gist.github.com/yglukhov/504513e00bff56dd401f38e1522d6cac |
16:49:45 | dom96 | yglukhov: you guys should livestream the next one if possible :P |
16:50:13 | dom96 | in fact, i'm considering setting up some sort of virtual meetup |
16:50:20 | yglukhov | but it will likely be not in English |
16:51:15 | cheatfate | yglukhov, your variant is working without asserts |
16:51:21 | yglukhov | it looks funny when Unkrainians are speaking English at conferences in Ukraine =) |
16:52:18 | cheatfate | yglukhov: and your variant also do not hide "deep recursion" bug |
16:52:30 | cheatfate | yglukhov, is it works for you? |
16:55:36 | yglukhov | cheatfate: it does |
16:55:45 | yglukhov | but. |
16:56:12 | yglukhov | returning to your measurements: 9 out of 217425. |
16:57:06 | dom96 | yglukhov: even so, would be nice. ~9% of nim-lang.org visitors are from Russia :) |
16:58:29 | yglukhov | don't you think that checking STATUS_PENDING may defer more completions than it should? |
16:59:10 | yglukhov | i mean, i understand the overall sanity behind not touching the buffer when STATUS_PENDING. but still... |
16:59:37 | cheatfate | yglukhov, there not so many docs about using OVERLAPPED structure with not initialized hEvent member |
17:00:19 | cheatfate | yglukhov, and we can know exactly only when we disassemble wsarecv() |
17:01:51 | yglukhov | cheatfate, ok, here's another point. 9 out of 217425 say complete with "complete with bytesReceived != 0". but with my gist and with the current impl you would get 217425 immediate completions instead. |
17:02:05 | yglukhov | right? |
17:02:27 | yglukhov | and my gist is also proven to work experimentally. |
17:03:15 | yglukhov | and you said that immediate completions are better than deffered, right? |
17:04:04 | yglukhov | dom96: ok, i guess its not really a problem to setup online stream. |
17:04:21 | cheatfate | yglukhov, ofc immediate completions are better, but completion routines will be called anyway... |
17:04:56 | cheatfate | yglukhov, because api function which modifies windows socket handle to stop notificate iocp is available only starting from vista |
17:05:06 | yglukhov | but the code wating for socket data will not wait for those routines. |
17:05:45 | * | brson quit (Quit: leaving) |
17:05:55 | dom96 | yglukhov: Yep. Plus, even if it's in a different language, it shows that there is interest in the language. |
17:06:34 | dom96 | Crystal recently streamed a meetup in Brazil |
17:07:42 | cheatfate | yglukhov, i have not received 217425 immediate completions... there was only 9 immediate completions because of my check "ol.internal != STATUS_PENDING" |
17:07:54 | yglukhov | dom96, have you considered a meetup in GB? |
17:07:56 | cheatfate | all other completions was deffered |
17:08:27 | yglukhov | cheatfate: i know. but with my gist you would get all of them immediately. |
17:08:36 | dom96 | yglukhov: I have, I don't really have a place to do it though. |
17:09:09 | yglukhov | dom96, oh thats not an excuse ;) |
17:09:15 | dom96 | lol |
17:09:26 | yglukhov | you could do it even outdoors. |
17:09:30 | dom96 | You're right. |
17:09:45 | dom96 | I could also use more time though, that's a better excuse :P |
17:10:08 | yglukhov | oh come on |
17:10:46 | cheatfate | yglukhov, your gist was not called even once... |
17:11:04 | cheatfate | yglukhov, so your patch just make all completions deffered |
17:11:23 | cheatfate | in my test |
17:11:26 | yglukhov | wait what |
17:11:32 | yglukhov | how could it be |
17:12:12 | cheatfate | i have modified your code with just `echo "completed immediately"` |
17:12:20 | cheatfate | and did not received any messages |
17:13:05 | yglukhov | are you looking at recv or recvInto? |
17:14:26 | cheatfate | wait i was wrong i have added to recv only |
17:15:15 | cheatfate | yglukhov, yeah your code also was called 9 times :) |
17:15:28 | cheatfate | from 215337 requests |
17:15:57 | cheatfate | there was only 9 immediate completions |
17:16:18 | cheatfate | but you need to understand this is was done only with "-d:release" |
17:16:18 | yglukhov | oh come on. take a look at it. it completes immediately always when bytesReceived != 0. |
17:16:36 | cheatfate | yglukhov, my tests cannot be run in debug mode |
17:16:51 | cheatfate | i can't simply make "nim c asynchttpserver" |
17:17:05 | cheatfate | because i there "deep recursion" bug still exists |
17:17:33 | cheatfate | there will be more "immediate completions" in debug variant |
17:17:41 | cheatfate | but in "release" there only 9 :) |
17:18:04 | cheatfate | i even dont know how you nimongo works in debug mode |
17:18:22 | cheatfate | maybe you need to run more heavy test |
17:18:41 | cheatfate | to receive "deep recursion" |
17:19:49 | yglukhov | nevertheless. do you still think that your variant with STATUS_PENDING is better? |
17:21:01 | cheatfate | yglukhov, even dont know, my variant is more bulletproof, just because it can handle "disconnections" immediately... your variant make "disconnections" to be deffered |
17:21:02 | * | fastrom quit (Quit: Leaving.) |
17:22:21 | cheatfate | yglukhov, but the only reason to use my variant is to handle DDoS |
17:22:39 | yglukhov | actually we can combine the best of our solutions. |
17:23:15 | yglukhov | i could add STATUS_PENDING check in case bytesReceived == 0. and complete immediately if not STATUS_PENDING |
17:23:42 | cheatfate | yglukhov, yeah it would be nice |
17:25:18 | cheatfate | yglukhov, but i think you need to add "HasOverlappedIoCompleted" |
17:25:25 | cheatfate | to winlean and use it |
17:26:39 | cheatfate | currently "HasOverlappedIoCompleted" is a macro in "winbase.h" |
17:26:47 | cheatfate | for both windows sdk and mingw |
17:31:36 | yglukhov | cheatfate: so is it winbase.h i have to include directly or through some other header? |
17:32:36 | cheatfate | yglukhov, i think you can simple include "windows.h" |
17:32:53 | cheatfate | mingw's windows.h have include <winbase.h> |
17:34:11 | cheatfate | microsoft sdk's windows.h also have include <winbase.h> |
17:38:05 | yglukhov | cheatfate, i'm afraid i will not be able to test my pr anymore, coz our last windows man has already left the office =). could you file the pr please? |
17:38:52 | cheatfate | yglukhov, you want me to make pr? |
17:38:58 | yglukhov | yup |
17:39:32 | yglukhov | will ya? |
17:40:22 | cheatfate | ok |
17:40:30 | yglukhov | cool, thanks a bunch |
17:40:34 | cheatfate | do you made recv to use recvInto? |
17:40:39 | yglukhov | nope |
17:41:20 | yglukhov | i guess it can be done later. |
17:41:30 | yglukhov | but feel free of course ;) |
17:43:33 | * | enthus1ast quit (Ping timeout: 240 seconds) |
17:44:06 | yglukhov | afk 2h |
17:48:44 | * | yglukhov quit (Ping timeout: 260 seconds) |
17:52:47 | cheatfate | dom96: https://github.com/nim-lang/Nim/blob/devel/lib/pure/asyncdispatch.nim#L686 do you create here one more copy of data? |
18:06:25 | dom96 | cheatfate: I don't think so |
18:06:41 | * | Jesin joined #nim |
18:07:01 | cheatfate | dom96, then i dont understand why you are using `$` |
18:14:20 | dom96 | cheatfate: might just be a left-over from when 'data' was a cstring |
18:29:09 | * | Arrrr quit (Quit: WeeChat 1.4) |
18:30:49 | * | yglukhov joined #nim |
18:32:03 | cheatfate | yglukhov, check it please https://github.com/nim-lang/Nim/pull/4150 |
18:32:40 | cheatfate | it works fine with asynchttpserver |
18:34:17 | * | Jesin quit (Quit: Leaving) |
18:35:54 | * | yglukhov quit (Ping timeout: 276 seconds) |
18:37:23 | * | Jesin joined #nim |
18:51:12 | * | yglukhov joined #nim |
19:06:27 | * | novavis quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
19:29:47 | Araq_ | $ on strings is a nop |
19:29:53 | Araq_ | optimized away, yay |
19:37:25 | * | novavis joined #nim |
19:38:14 | * | brson joined #nim |
19:42:24 | * | enthus1ast joined #nim |
19:43:33 | * | ephja quit (Quit: WeeChat 1.5) |
19:44:31 | * | novavis quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
20:02:10 | * | yglukhov_ joined #nim |
20:02:10 | * | yglukhov quit (Read error: Connection reset by peer) |
20:05:17 | * | yglukhov_ quit (Read error: Connection reset by peer) |
20:05:42 | * | yglukhov joined #nim |
20:10:26 | * | yglukhov quit (Read error: Connection reset by peer) |
20:10:34 | * | yglukhov joined #nim |
20:12:14 | * | yglukhov quit (Read error: Connection reset by peer) |
20:15:27 | * | novavis joined #nim |
20:15:41 | * | novavis quit (Client Quit) |
20:20:51 | * | yglukhov joined #nim |
20:24:42 | * | zodiak quit (Ping timeout: 260 seconds) |
20:27:03 | libman | Are there any exciting new asynchttpserver benchmarks by any chance? |
20:28:16 | libman | Nim's performance in Web Framework benchmarks has been rather disappointing so far, but I see great potential... http://forum.nim-lang.org/t/1152 |
20:31:14 | libman | https://github.com/nanoant/WebFrameworkBenchmark didn't update in 5 months... |
20:36:46 | * | Jesin quit (Quit: Leaving) |
20:56:55 | * | zodiak joined #nim |
20:57:20 | dom96 | libman: afraid not |
20:58:13 | libman | Any future predictions? :P |
20:58:51 | * | endragor quit (Read error: Connection reset by peer) |
20:59:09 | * | endragor joined #nim |
21:02:16 | * | fastrom joined #nim |
21:17:15 | * | Demon_Fox joined #nim |
21:20:40 | * | vendethiel quit (Quit: q+) |
21:26:17 | * | pregressive quit (Remote host closed the connection) |
21:31:03 | * | GangstaCat quit (Quit: Leaving) |
21:36:59 | dom96 | Araq_: why does this fail to compile? https://gist.github.com/dom96/a518108352d0c1249359c6e4807466c6 |
21:37:42 | Araq_ | int doesn't convert to float because both could be 64bits |
21:38:42 | * | endragor_ joined #nim |
21:42:52 | * | endragor quit (Ping timeout: 260 seconds) |
21:43:14 | * | endragor_ quit (Ping timeout: 260 seconds) |
21:43:39 | * | GangstaCat joined #nim |
21:44:14 | dom96 | Araq_: argh, but it's so annoying |
21:44:36 | Araq_ | converter letItBe(x: int): float = float(x) |
21:45:00 | dom96 | hehe |
21:45:21 | dom96 | nice hack, but that just doesn't feel right |
21:46:05 | Araq_ | well Nim says only conversions which cannot lose precision are implicit |
21:46:25 | Araq_ | you cannot convert every 64bit int to a 64bit float |
21:46:30 | Araq_ | so what should we do? |
21:46:40 | dom96 | why can't we? |
21:49:12 | cheatfate | dom96, and why its annoying? just use 5.0 + 5.5 and you will be find |
21:49:17 | cheatfate | fine* |
21:49:27 | cheatfate | its a good error |
21:50:38 | cheatfate | but ofc maybe i'm too old and dont like floats at all |
21:50:41 | dom96 | it's annoying because I have to cast manually to an int or float |
21:51:40 | cheatfate | dom96, you are trying to make python from nim i think :) |
21:55:31 | dom96 | I don't think so |
21:55:38 | * | gokr quit (Ping timeout: 276 seconds) |
21:59:27 | cheatfate | i think now all modern languages trying to return to `strict typing` |
21:59:28 | libman | I second the "make python from nim" proposal. :P |
22:00:14 | libman | optional strict typing is great, when optional |
22:02:44 | cheatfate | libman, 20 years ago, not all processors even floating point arithmetic inside... |
22:02:50 | cheatfate | even has |
22:03:23 | cheatfate | and now you trying to mix something for what processors are not suitable |
22:04:44 | * | fastrom quit (Quit: Leaving.) |
22:11:40 | * | Jesin joined #nim |
22:16:11 | libman | I'm just brainstorming selling points for Nim. Right now it's neither the fastest nor the most productive language. How can it compete with writing a project in Python and optimizing parts of it in C? |
22:16:56 | Araq_ | neither Python nor C have a decent static typing system. |
22:17:01 | Araq_ | neither has good meta programming |
22:17:08 | libman | What Nim can be is the language that occupies the broadest width in the middle of the efficiency or productivity tradeoff spectrum. |
22:17:38 | libman | *efficiency VS productivity |
22:18:31 | libman | (It can also be the copyfree'est language, but I know most people don't care about that.) |
22:19:51 | libman | So I'm wondering if Nim can take a configurable "why not both" approach on things like implicit casting. Spectrum width FTW! |
22:24:04 | * | alexsystemf__ quit (Ping timeout: 260 seconds) |
22:25:30 | * | libman left #nim (#nim) |
22:25:36 | * | libman joined #nim |
22:25:38 | * | alexsystemf__ joined #nim |
22:26:35 | Araq_ | libman: for me it IS the most productive language. by far. :P |
22:28:17 | tautologico | the tendency now is static typing and compiled |
22:29:09 | tautologico | dynamic languages were an artifact from a time when people thought performance didn't matter, because new CPUs would make your code faster in a few months anyway |
22:29:18 | libman | Thinking about an objective way to measure dev productivity. |
22:37:36 | libman | Really the package selection matters more than anything else. Writing a nim program to download YouTube videos? In Python, `import youtube_dl` is half the code you need. |
22:39:33 | libman | And yet node managed to be very unproductive for me, despite npm packages breeding like rabbits... |
22:42:16 | cheatfate | libman, and when somebody ask you to make program which download youtube video... you give him script and 2 pages of instructions to download and install appropriate version of python, updating pip collection, and installing youtube_dl module... and after all this shit has done, you telling your customer or friend that your program is only working on linux/unix or windows systems... and on windows you need to start it with cmd -> python |
22:42:16 | cheatfate | youtubedownloader.py |
22:43:54 | cheatfate | i like python, i like asyncio of python, but i hate people which dont like to make it equal for all systems |
22:44:07 | libman | I used that example because youtube_dl works for multiple video hosting sites and it gets updated every few days to keep track of all the API changes / obfuscations / etc. |
22:44:57 | cheatfate | libman, it doesnt matter because to distribute your software you need to do a big amount of work... |
22:45:06 | * | elrood quit (Quit: Leaving) |
22:45:07 | cheatfate | while you are on python |
22:46:19 | cheatfate | libman, and when you are speaking on speed... asynchttpserver.nim is 10x faster then python's aiohttp |
22:47:16 | libman | I'm not here to evangelize Python, I'm here to convince myself to finally embrace Nim. :) |
22:47:48 | * | Trustable quit (Remote host closed the connection) |
22:48:28 | libman | (Although, technically, python has that covered with auto-updating executables - https://github.com/cloudmatrix/esky) |
22:49:12 | cheatfate | libman, you can check this code https://gist.github.com/cheatfate/99fa898a9affd370d5cb1225df9f4ca6 it was made just for fun... before nim i can make same thing only in C or ASM |
22:52:31 | * | yglukhov quit (Remote host closed the connection) |
22:53:03 | cheatfate | nim is just a little bit higher than C and its why i like it |
22:54:15 | libman | What does any of that have to do with what I was talking about? |
22:55:27 | libman | A flag to enable implicit casting would widen nim's appeal. |
22:56:21 | cheatfate | implicit casting is a step back in time... |
22:57:38 | cheatfate | yeah it makes coding easier but it also adds to code a bunch of chaos which you dont want to control |
22:58:54 | libman | Sometimes you just want to tell the compiler: I care about X (ex. productivity in finishing this one-off data converter), not Y (performance, type safety, concurrency, portability, not having access to nuclear launch codes, etc). |
23:00:52 | * | yglukhov joined #nim |
23:00:53 | libman | Selling Nim to someone who knows Python and C well is hard. |
23:05:50 | * | yglukhov quit (Ping timeout: 276 seconds) |
23:06:50 | cheatfate | libman, i think you also want compiler to which you can tell: I want youtube and facebook video downloader for Linux/Windows/MacOS in one executable package... |
23:07:25 | cheatfate | and maybe in next 100 years you will see such thing... |
23:07:33 | libman | That's a package availability issue, not a compiler issue. |
23:08:06 | * | PMunch joined #nim |
23:14:23 | Araq_ | libman: the real problem is that selling a new language to a happy programmer is hard. IME. |
23:14:58 | Araq_ | if you think C/Python is a perfectly fine combo, then so be it. |
23:15:13 | Araq_ | I think C is archaic and I cannot stand Python's dynamic typing. |
23:15:27 | libman | I had to quit Python, mainly because I'm a copyfree fanatic. |
23:16:57 | libman | So if the Nim community was to ostracize programmers to write non-copyfree "free software" libraries in Nim, that would be even better. :P |
23:17:08 | libman | *WHO write |
23:20:12 | cheatfate | libman, python is not copyfree? |
23:20:31 | libman | http://copyfree.org/standard/rejected :( |
23:21:12 | libman | http://libman.org/img/bak/pythonSadLicenseFoo.png |
23:24:22 | * | nsf joined #nim |
23:24:41 | * | StarBrilliant quit (Ping timeout: 276 seconds) |
23:24:54 | libman | PyPy and some fraction of packages are copyfree, but not the standard library isn't. |
23:25:48 | cheatfate | too many text for me about copyfree... is there `one sentence` explanation? |
23:28:58 | libman | It's a "line in the sand" against restrictive licenses; only "don't hurt me, don't pretend you wrote it" licenses like MIT make the cut; for people who want to liberate the free software industry from lawyers and socialists claiming that only Mommy Government's copyleft enforcement had made free software possible. |
23:31:24 | * | StarBrilliant joined #nim |
23:31:27 | cheatfate | libman, i think you know that free software industry is a first step to socialism and socialism its just a light version of communism |
23:31:33 | * | arnetheduck quit (Ping timeout: 240 seconds) |
23:34:15 | libman | Nope, free software is a natural and inevitable free market capitalist phenomenon. People do it for their rational self-interest. |
23:52:39 | cheatfate | I dont understand Microsoft... they introduced in Windows Vista GetQueuedCompletionStatusEx() function, but this function dont give any significant speed increase vs old GetQueuedCompletionStatus() |
23:58:56 | cheatfate | its like 0.01 ms |