00:07:19 | Araq | good night |
00:18:26 | * | cariboo quit (Quit: Leaving) |
00:18:46 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
00:28:04 | * | Jehan_ quit (Quit: Leaving) |
00:51:41 | * | johnsoft joined #nimrod |
00:53:46 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
01:02:10 | * | bjz joined #nimrod |
01:02:41 | * | bjz quit (Client Quit) |
01:23:03 | * | johnsoft quit (Ping timeout: 240 seconds) |
01:23:27 | * | johnsoft joined #nimrod |
01:39:56 | * | bjz joined #nimrod |
01:42:29 | * | brson quit (Quit: leaving) |
01:59:25 | * | shodan45 quit (Quit: Konversation terminated!) |
02:02:26 | * | mwbrown joined #nimrod |
02:02:41 | * | mwbrown quit (Remote host closed the connection) |
02:10:22 | * | q66 quit (Quit: Leaving) |
02:11:39 | * | mwbrown joined #nimrod |
02:15:05 | * | bjz_ joined #nimrod |
02:16:11 | * | bjz quit (Ping timeout: 264 seconds) |
02:20:38 | * | gsingh93 joined #nimrod |
02:21:36 | * | bjz joined #nimrod |
02:22:05 | * | johnsoft quit (Ping timeout: 250 seconds) |
02:22:11 | * | bjz_ quit (Ping timeout: 255 seconds) |
02:22:56 | * | johnsoft joined #nimrod |
02:23:57 | * | saml_ joined #nimrod |
02:26:01 | * | kemet joined #nimrod |
02:28:01 | * | kemet quit (Client Quit) |
02:34:13 | * | bjz_ joined #nimrod |
02:37:35 | * | bjz quit (Ping timeout: 256 seconds) |
02:49:47 | * | Fx00F quit (Quit: leaving) |
02:54:53 | Skrylar | so now that the siphash stuff is a babel package, should i sent in the PR? (i babelized it on github a while back) |
02:57:49 | flaviu | Skrylar: Link please? |
03:04:20 | flaviu | I can't find siphash in babel, does it have another name? |
03:06:52 | flaviu | Skrylar: Ok, found it. I don't know about anyone else, but I'd like mixing and finalization separated out into their own steps so that its composable |
03:28:25 | Skrylar | i'd have to go look at it again |
03:28:42 | Skrylar | IIRC i ported it from the reference implementation, so if it doesn't do it then the original doesn't either |
03:58:57 | flaviu | Skrylar: The paper describes the individual steps, but the implementation puts all the steps together |
04:03:41 | * | Skrylar shrugs |
04:22:07 | * | flaviu quit (Ping timeout: 240 seconds) |
04:26:23 | * | brson joined #nimrod |
04:26:34 | * | brson quit (Client Quit) |
04:33:18 | Skrylar | yup. just hijacking siphash as an RNG would have taken less time than me trying to figure out how multiply w/ carry works :/ |
04:41:19 | Skrylar | well thats new |
04:41:26 | Skrylar | i didn't know nimrod did under/overflow checking for ints |
04:45:36 | * | flaviu joined #nimrod |
05:01:59 | * | bjz_ quit (Ping timeout: 250 seconds) |
05:03:40 | * | ARCADIVS joined #nimrod |
05:05:23 | * | saml_ quit (Quit: Leaving) |
05:15:42 | * | bjz joined #nimrod |
05:16:35 | * | Fx00F joined #nimrod |
05:22:03 | Fx00F | nimrod-by-example.github.io, the example in the main page: Error: undeclared identifier: 'newCountTable' |
05:25:30 | Fx00F | what's the new identifier for hash tables? |
05:31:01 | * | flaviu quit (Ping timeout: 250 seconds) |
05:36:23 | Fx00F | found it, it's initCountTable |
05:53:17 | * | Fx00F quit (Quit: leaving) |
06:03:15 | * | Demos quit (Read error: Connection reset by peer) |
06:08:12 | Skrylar | oO |
06:08:26 | Skrylar | Aren't PRNGs supposed to have uniform histograms |
06:11:33 | adoniscik | by default |
06:13:21 | Skrylar | I implemented a multiply-with-carry generator and used mod(10)+1 to simulate rolling d10; I think I did this incorrectly, because according to R the distributions are crazy |
06:13:39 | Skrylar | i think it probably needs to be scaled to a float and raised back up |
06:18:41 | * | mwbrown quit (Ping timeout: 250 seconds) |
06:19:36 | * | gsingh93 quit (Quit: Connection closed for inactivity) |
06:20:26 | Skrylar | yeah thats WAY more uniform |
06:23:26 | adoniscik | is there an easy way to define commutative procs: proc (a: T, b: S) = proc(b: S, a:T)? |
06:23:38 | adoniscik | without repeating the declaration, of course |
06:24:09 | Skrylar | that could be done with a template/macro, likely |
06:25:50 | * | Skrylar ponders how exactly that would be done |
06:26:58 | Skrylar | adoniscik: if you don't mind the extra typing, "template blah(b: S; a: T): return = blah(a, b)" would do it for 'free' in that template expansion would just flip it around |
06:27:19 | Skrylar | s/return/R |
06:29:48 | Skrylar | I think there would be a way to make it so all you'd have to do is just type commutative(function_name), but I do not recall if the macro system would be able to eyeball the parameter types for that |
06:31:46 | * | Mooneye joined #nimrod |
06:32:00 | adoniscik | good idea |
06:34:42 | adoniscik | should you declare all side effect-free proc arguments var ? |
06:35:08 | Skrylar | procvar? |
06:35:19 | adoniscik | proc foo(x : var T) |
06:35:36 | * | gsingh93 joined #nimrod |
06:35:38 | Skrylar | ok, what noSideEffects does is make it so anything which isn't directly passed in to the function is taboo |
06:35:51 | adoniscik | oh right that pragma |
06:35:51 | Skrylar | so you are allowed to change x.bar within that function, ONLY if it was passed in through a var parameter |
06:36:08 | Skrylar | you are not allowed to change globals, for instance |
06:36:19 | Skrylar | its basically a good behavior enforcer, but there are occasional times not to use it |
06:36:40 | adoniscik | what's the var keyword with arguments for? |
06:36:53 | Skrylar | means they are pass-by-ref and modifiable |
06:36:58 | Skrylar | if i have a non-pointer (a: X) |
06:37:05 | Skrylar | a.foo = 22 # not allowed |
06:37:11 | Skrylar | if (a: var X) |
06:37:15 | Skrylar | a.foo = 22 # allowed |
06:37:31 | adoniscik | so it's completely the opposite of what I wanted :) |
06:37:45 | Skrylar | yes, leave 'var' off if you want it immutable |
06:37:50 | Skrylar | note that this goes out the window for pointers |
06:38:02 | Skrylar | if you have (a: pointer), you can still dereference a and modify it |
06:38:07 | Skrylar | you just can't change the /pointer/ |
06:38:10 | adoniscik | but if immutability is the default, what does noSideEffect do again? |
06:38:21 | Mooneye | Skrylar: will (a: X) do expensive copying? or is it just immutability that it specifies? |
06:38:27 | Skrylar | adoniscik: it enforces no side effects |
06:38:39 | Skrylar | adoniscik: for instance you can modify a global, but not if noSideEffects is set |
06:38:54 | Skrylar | it also bans a lot of unsafe pointer code |
06:39:11 | Skrylar | Mooneye: IIRC it will still pass-by-ref objects, but they are not mutable |
06:39:14 | Skrylar | the compiler will moan |
06:39:31 | Mooneye | Skrylar: sick. Nimrod looks so awesome. |
06:39:36 | Skrylar | It is. |
06:39:44 | Skrylar | Its like a good version of pascal lol |
06:40:00 | Mooneye | never used it. |
06:40:08 | Skrylar | well its like a weird python then |
06:40:17 | Mooneye | never used python, either. |
06:40:22 | * | Skrylar crawls underneath a mushroom |
06:40:28 | Mooneye | :P I was messing with you |
06:40:31 | Mooneye | I've used Python haha |
06:40:44 | adoniscik | hehehe |
06:40:58 | Skrylar | the macro system looks a little lispy on the inside though |
06:41:03 | Skrylar | which is good, i like lisp |
06:41:10 | Mooneye | I've used scheme |
06:41:12 | Mooneye | wasn't a fan |
06:41:39 | Skrylar | honestly i wouldn't mind a lisp microkernel |
06:41:58 | Skrylar | i can think of a few ways to map a lot of programming languages to s-expressions that people don't actually touch |
06:42:13 | Mooneye | Skrylar: Greenspun's 10th |
06:42:31 | Skrylar | Mooneye: Yup. |
06:42:51 | Skrylar | Now imagine if instead of Java, you had a microlisp built to be compiled so you had actual CLOS instead xD |
06:43:17 | Mooneye | you lost me. what's CLOS? what's microlisp? |
06:43:31 | Skrylar | Oh. Common Lisp Object System |
06:43:32 | Mooneye | nevermind googled it |
06:43:33 | Mooneye | haha |
06:43:38 | Skrylar | Thats one of the parts of greenspun's 10th :P |
06:43:47 | Skrylar | Eventually in a big enough OO system, they reinvent CLOS in C |
06:43:47 | Mooneye | is it? |
06:43:52 | Mooneye | oh okay |
06:43:56 | Mooneye | I never read that part |
06:43:59 | Mooneye | must've been an amendment |
06:44:49 | Skrylar | Dreaming of a lisp microkernel is a pipe dream sadly :( |
06:45:06 | Skrylar | Even if its so much better of an idea than a million JVM clones |
06:45:52 | Mooneye | Skrylar: That's where Greenspun's rule comes in. |
06:46:18 | Mooneye | A modularly functional C kernel is basically what you're talking about |
06:46:22 | Mooneye | unless I'm totally ignorant |
06:47:42 | Skrylar | something like that |
06:48:27 | Skrylar | i was thinking about how a lot of C/C++/Java/Nimrod/et all code could be easily structured similarly in lisp form |
06:48:45 | Skrylar | which would make the need for millions of compilers and IDE tools go away, as you just need to understand the lisp |
06:51:28 | Mooneye | maybe I should do more lisp programming. |
06:58:24 | Skrylar | i don't recommend it unless you have a lot of free time; the free lisps are bad at making redistributables |
07:06:55 | Mooneye | Skrylar: Too many languages are bad at making redistributables. |
07:17:26 | * | io2 joined #nimrod |
07:35:37 | Skrylar | Mooneye: nimrod is good at it |
07:35:43 | Skrylar | IIRC there are zero dependencies |
07:36:06 | Skrylar | since a lot of stdlib is just brought in from C, and the parts that aren't C have dead code elimination across all modules (e.g. delphi smartlink) |
07:40:03 | Mooneye | Nimrod compiles to C, right? |
08:01:36 | adoniscik | what's wrong with the following code? http://pastebin.com/cCJDWrhQ |
08:02:11 | adoniscik | I get a type mismatch error on the proc's last line by the *= |
08:11:35 | adoniscik | how can you define an argument to be one of several types? |
08:11:50 | adoniscik | like a generic, but more specific |
08:17:19 | * | Matthias247 joined #nimrod |
08:19:09 | * | io2 quit (Quit: ...take irc away, what are you? genius, billionaire, playboy, philanthropist) |
08:19:46 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
08:25:11 | * | Trustable joined #nimrod |
08:42:06 | adoniscik | I'm closer. I defined a type T using the or operator. However, when it comes time to use it in a generic proc, it wants all arguments of type T to be identical, whereas I want them to be any of the constituent types of T. How can I solve this? |
08:56:07 | * | adoniscik quit (Ping timeout: 256 seconds) |
09:29:15 | * | ARCADIVS quit (Quit: WeeChat 0.4.3) |
09:30:32 | * | Mooneye quit (Quit: Leaving) |
09:39:36 | * | gsingh93 quit (Quit: Connection closed for inactivity) |
10:09:25 | dom96 | hi |
10:26:33 | * | BitPuffin quit (Ping timeout: 250 seconds) |
10:28:29 | * | Francisco quit (Ping timeout: 256 seconds) |
10:32:31 | Araq | hi dom96 |
10:33:09 | dom96 | hey Araq. Sup? |
10:34:31 | Araq | I'm going through the github issues ... |
10:41:03 | * | Fr4n joined #nimrod |
10:44:47 | dom96 | Araq: Settled on an idea on how to fix the corruption yet? |
10:46:21 | Araq | yes |
10:46:37 | Araq | after 'yield' I'll create another potential closure creation point |
10:46:49 | Araq | this should fix it without introducing new regressions |
10:47:01 | Araq | but it doesn't improve efficiency |
10:49:14 | NimBot | Araq/Nimrod devel 78b56bf Simon Jakobi [+0 ±1 -0]: sequtils: Complete mapIt documentation example |
10:49:14 | NimBot | Araq/Nimrod devel aeddc6f Andreas Rumpf [+0 ±1 -0]: Merge pull request #1378 from sjakobi/patch-2... 2 more lines |
10:49:32 | NimBot | Araq/Nimrod devel 4c4ebc9 Simon Jakobi [+0 ±1 -0]: sequtils: Correct documentation for keepIf proc |
10:49:32 | NimBot | Araq/Nimrod devel 188df67 Andreas Rumpf [+0 ±1 -0]: Merge pull request #1377 from sjakobi/patch-1... 2 more lines |
10:49:42 | * | q66 joined #nimrod |
10:50:17 | Araq | dom96: or should we do it the efficient way and see what breaks? |
10:50:50 | Araq | should only effect edge cases |
10:51:00 | Araq | and I think I have tests for it |
10:52:06 | dom96 | well this corruption was easy to find, the next may not be so easy... |
10:52:28 | dom96 | although I guess you'll know where to look |
10:53:19 | dom96 | I'd prefer if it just worked though |
10:53:28 | dom96 | So that I could make sure everything else works |
10:57:49 | Araq | well the resulting speed increase should be welcome |
10:58:13 | Araq | and as I said, pretty much every language except C# gets it wrong too and people don't notice |
11:07:05 | dom96 | it's fast enough for now |
11:08:56 | Araq | maybe but where does the next speedup will come from? |
11:09:10 | Araq | we're running out of ideas already, right? |
11:09:37 | dom96 | lol nope |
11:10:06 | dom96 | well, there is plenty of micro-optimisations we can do I think |
11:10:45 | dom96 | the profiler does mention newObj as being used heavily, but that's due to the amount of futures created I think |
11:11:59 | * | Matthias247 quit (Read error: Connection reset by peer) |
11:12:59 | Araq | er ... yes? like in a loop? |
11:13:13 | Araq | which my patch will transform out of the loop |
11:14:23 | Araq | we should really do it this way |
11:14:37 | dom96 | hrm. I think I get it. |
11:14:56 | dom96 | So your patch won't only affect the newObj for the env? |
11:15:18 | Araq | it will pull it out of the loop |
11:15:23 | Araq | well hrm |
11:15:34 | Araq | that should help much ... damn |
11:15:57 | dom96 | iterator fooIter(): PFutureBase = |
11:16:02 | dom96 | var retFuture = newFuture() |
11:16:08 | dom96 | no wait |
11:16:16 | dom96 | that retFuture is outside the iterator already |
11:16:26 | dom96 | so it won't be affected by your patch |
11:16:34 | Araq | yes |
11:17:03 | Araq | *that should not help much |
11:17:13 | dom96 | ahh |
11:17:18 | dom96 | well there you go :P |
11:17:33 | Araq | unless I do it differently :P |
11:17:53 | Araq | argh |
11:18:02 | Araq | too hard to think about it, need to try it |
11:18:17 | Araq | perhaps it then merges the closures and then we win |
11:19:21 | dom96 | I would prefer if you would fix the corruption and then worry about optimizations |
11:20:11 | * | Machielo joined #nimrod |
11:21:18 | Machielo | morning |
11:23:02 | dom96 | hello Machielo! |
11:24:09 | Araq | dom96: that DOES fix the corruption |
11:24:29 | Araq | but I've got some nice GC optimizations in the works too ... |
11:24:57 | Araq | hi Machielo welcome |
11:25:07 | * | BitPuffin joined #nimrod |
11:25:47 | dom96 | Araq: I know. But maybe there are easier ways to fix it. |
11:25:59 | Araq | dom96: in fact this fix is much more bullet proof than the alternative |
11:26:53 | Araq | the alternative is more fragile and I don't know if it covers all cases |
11:28:34 | Machielo | thanks Araq :) |
11:35:44 | goobles | POOP |
11:36:17 | Machielo | sorry to interrupt guys, but I'm new so what's the preferred method of issuing a feature request/offer help in nimrod? shorta like pep proposals in python? |
11:36:24 | Machielo | the forum? this channel? |
11:37:11 | Machielo | is there a mailing list? sorry for the ton of questions :) |
11:41:59 | Araq | we have a single NEP somewhere in the wiki |
11:42:09 | Araq | usually the bug tracker is used for feature requests |
11:43:11 | Araq | I don't really like this but now we can easily filter so it'll stay this way |
11:43:32 | Machielo | ok good :) |
11:43:38 | Machielo | and the github issues page? |
11:43:52 | Araq | that's what I mean with "bug tracker" |
11:44:22 | Araq | in general people don't offer help but make PRs instead ;-) |
11:44:54 | Araq | well ... they offer help here via IRC |
11:45:40 | Araq | in general IRC is my preferred method, answering on the forum takes more time and I can't rant on the forum ;-) |
11:46:33 | Machielo | good thanks! just to know how it works :) |
11:47:00 | Machielo | I guess I'll have to re-learn how to use irc :D |
11:48:09 | Fr4n | Machielo, just join the channel 0 and you're done |
11:50:41 | * | Machielo left #nimrod (#nimrod) |
11:50:51 | * | Machielo joined #nimrod |
11:50:57 | Machielo | I did join channel 0 :D |
11:54:41 | Araq | yes, this is the right channel |
11:55:30 | * | Fr4n quit (Ping timeout: 250 seconds) |
11:59:02 | Araq | hi goobles |
11:59:21 | Araq | nice that you're around but POOP is a somewhat strange greeting |
11:59:53 | dom96 | Maybe it's an unfortunate acronym |
12:00:55 | * | Machielo left #nimrod (#nimrod) |
12:08:34 | * | Fr4n joined #nimrod |
12:17:13 | Araq | bbl |
12:27:41 | * | darkf quit (Quit: Leaving) |
12:32:42 | * | untitaker quit (Ping timeout: 245 seconds) |
12:37:25 | * | q66 quit (Quit: Leaving) |
12:37:39 | * | Ven joined #nimrod |
12:39:20 | * | untitaker joined #nimrod |
12:39:56 | * | q66 joined #nimrod |
12:47:29 | * | q66 quit (Remote host closed the connection) |
12:48:32 | * | kemet joined #nimrod |
12:51:22 | * | q66 joined #nimrod |
12:54:06 | * | saml_ joined #nimrod |
13:08:57 | * | Machielo joined #nimrod |
13:12:50 | * | flaviu joined #nimrod |
13:15:27 | flaviu | Skrylar: Still not correct thouth :P |
13:15:55 | flaviu | You have to discard randomness to get a truly uniform distribution |
13:16:23 | flaviu | going to a float leads to all sorts of difficult to understand and subtle baises |
13:20:33 | * | q66 quit (Quit: Leaving) |
13:29:59 | * | kemet quit (Quit: Instantbird 1.5 -- http://www.instantbird.com) |
13:29:59 | * | Machielo quit (Read error: Connection reset by peer) |
13:30:55 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
13:31:10 | * | Machielo joined #nimrod |
13:40:06 | * | Ven joined #nimrod |
13:48:57 | * | q66 joined #nimrod |
13:49:50 | flaviu | dom96: Thanks for fixing that |
13:50:55 | dom96 | np |
13:56:03 | Machielo | hi, newbie question: would a syntax like `finished(iterator, variable): bool` where it returns true/false and sets the iterator's returned value on var make sense? i realize it's just syntactic sugar, just wondering |
13:56:25 | * | io2 joined #nimrod |
13:56:40 | * | io2 quit (Client Quit) |
13:56:59 | Machielo | would make it easier to type things like `let x = iterator; if finished(iterator): break; use x` |
13:58:12 | def- | Machielo: why not just this?: for x in iterator: use x |
13:58:36 | Machielo | yeah of course, but this is for when you don't for-through the iterator, for more complex stuff |
13:58:50 | Machielo | but I get it's not as common |
13:59:07 | def- | Machielo: but yes, i guess you could make a proc finished[T](iterator; x: var T): bool |
13:59:58 | Machielo | yeah, do you think it makes sense? or it's just clutter? |
14:00:24 | def- | I would have to see the code where you want to use it. not sure like this |
14:00:32 | * | q66 quit (Remote host closed the connection) |
14:01:05 | Machielo | hmm not real code I'm afraid, just playing with the language and snippets |
14:01:46 | * | io2 joined #nimrod |
14:01:56 | Machielo | like http://nimrod-lang.org/manual.html#first-class-iterators |
14:02:04 | Machielo | the finished(x) example |
14:03:02 | Machielo | but I guess that's even more flexible and this doesn't solve that one so it's clutter :) |
14:03:24 | def- | Still always fun to implement ideas just to see how it would be done |
14:03:42 | Machielo | yeah! I'm gonna keep on playing |
14:03:45 | Machielo | thanks! |
14:04:00 | * | q66 joined #nimrod |
14:14:16 | * | zling_ joined #nimrod |
14:30:02 | dom96 | hello zling_, welcome |
14:30:02 | * | Machielo quit (Read error: Connection reset by peer) |
14:30:37 | * | Machielo joined #nimrod |
14:48:21 | * | flaviu quit (Remote host closed the connection) |
14:52:23 | * | flaviu joined #nimrod |
15:05:01 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
15:10:37 | * | saml_ quit (Ping timeout: 245 seconds) |
15:15:36 | * | Ven joined #nimrod |
15:18:57 | * | Demos joined #nimrod |
15:27:32 | flaviu | I can't convert https://gist.github.com/1ff3407e6aecd3526a8a with c2nim, even though it looks simple. There seems to be an error on the DOUBLE_ROUND define |
15:28:05 | dom96 | flaviu: Try s/define/def/ |
15:29:36 | flaviu | Thanks, that works, but now it says its missing a semicolon at the end of an invocation of the macro |
15:29:51 | fowl | flaviu, those multi-line macros will never translate correctly |
15:30:10 | fowl | just comment them out and write them in nimrod later |
15:31:56 | * | fowl quit (Quit: goodbye, cruel server) |
15:33:18 | * | mwbrown joined #nimrod |
15:36:10 | * | fowl joined #nimrod |
15:36:26 | flaviu | fowl: I don't see why they won't work, but that sort of works. |
15:36:54 | flaviu | Final question hopefully: How do I translate those defineds into nimrod? |
15:37:05 | flaviu | __ is illegal in identifiers |
15:37:49 | mwbrown | flaviu: doesn't it ignore capitalization and underscores? |
15:37:57 | mwbrown | maybe you could use just one underscore instead |
15:38:40 | fowl | flaviu, HALF_ROUND and DOUBLE_ROUND could be templates or functions, your choice |
15:39:22 | flaviu | Inline functions probably, but my problems are with the when defineds, since they use underscores |
15:39:34 | fowl | irt the __ idents, they'll have to be fixed by hand |
15:39:54 | flaviu | Just get rid of the extra underscores? |
15:40:10 | fowl | flaviu, i'd take out all that endian crap, theres a constant in system.nim that has your endianness and endians.nim has functions to swap endianness |
15:41:06 | flaviu | Ok, thanks |
15:41:33 | fowl | looks like _le64toh() can be replaced with bigEndian64() |
15:42:17 | mwbrown | fowl: wouldn't that break on a little-endian system? |
15:43:52 | mwbrown | something like le64toh would need a conditional on system.cpuEndian |
15:43:52 | * | Machielo quit (Read error: Connection reset by peer) |
15:44:27 | flaviu | mwbrown: https://github.com/Araq/Nimrod/blob/188df67677912189438226b96e765ee034b2ff9f/lib/pure/endians.nim#L57 |
15:44:52 | mwbrown | Right. When you call le64toh on a little-endian system, it is supposed to be a no-op |
15:44:59 | * | Machielo joined #nimrod |
15:45:11 | fowl | right |
15:45:19 | flaviu | Yes, it is. Just a copymem, with no side effects |
15:45:20 | fowl | you want littleEndian64() i think |
15:45:30 | mwbrown | yes |
15:45:50 | flaviu | Don't worry about it, unless you want to. I'll figure this all out eventually |
15:46:05 | mwbrown | meh. on IRC and bored, might as well help out haha |
15:46:43 | flaviu | Anyway, I think I'll translate by hand instead. C2Nim is ugly |
15:46:49 | flaviu | and wrong, I think |
15:47:16 | flaviu | It emited a case statement instead of a series of fallthrough ifs |
16:03:58 | * | bjz joined #nimrod |
16:24:23 | * | wan quit (Quit: WeeChat 0.4.3) |
16:25:10 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
16:31:10 | * | bjz quit (Read error: Connection reset by peer) |
16:31:10 | * | Machielo quit (Read error: Connection reset by peer) |
16:32:11 | * | Machielo joined #nimrod |
16:33:56 | * | Fr4n quit (Ping timeout: 260 seconds) |
16:35:13 | * | Varriount_ joined #nimrod |
16:36:38 | * | Varriount quit (Ping timeout: 240 seconds) |
16:42:53 | * | Ven joined #nimrod |
16:42:53 | * | Machielo quit (Read error: Connection reset by peer) |
16:43:23 | * | Machielo joined #nimrod |
16:45:18 | * | BitPuffin quit (Ping timeout: 255 seconds) |
16:46:25 | * | Fr4n joined #nimrod |
16:46:43 | * | Matthias247 joined #nimrod |
16:57:02 | * | q66 quit (Remote host closed the connection) |
16:58:18 | * | q66 joined #nimrod |
16:59:28 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
17:04:11 | * | Ven joined #nimrod |
17:38:59 | * | springbok quit (Ping timeout: 264 seconds) |
17:40:23 | * | Machielo quit (Quit: WeeChat 0.4.3) |
17:42:24 | Varriount_ | Hello people! |
17:42:35 | * | Varriount_ is now known as Varriount |
17:42:45 | def- | hi Varriount! |
17:59:16 | * | ics joined #nimrod |
18:09:10 | * | adoniscik joined #nimrod |
18:14:23 | * | Machielo joined #nimrod |
18:16:01 | * | Machielo quit (Client Quit) |
18:17:47 | * | Machielo joined #nimrod |
18:22:28 | * | boydgreenfield joined #nimrod |
18:25:28 | * | ics quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
18:25:37 | boydgreenfield | Is there a community consensus on prefixes for type names in packages (i.e., TMytype)? I seem to remember someone saying folks were moving away from this, but can’t remember. (Context: About to open up a Bitarray implementation and am wondering if I should leave the type as TBitarray or rename it BitArray). Thanks! |
18:26:40 | Araq | the consensus is to remove the T/P |
18:27:44 | boydgreenfield | Araq: Thanks. Got it. For P* types, is there an emerging convention around noting that’s it’s a reference in some way? |
18:27:44 | * | Machielo quit (Read error: Connection reset by peer) |
18:28:26 | Varriount | boydgreenfield: Styleguide answers all -> https://github.com/Araq/Nimrod/wiki/NEP-1-:-Style-Guide-for-Nimrod-Code |
18:28:27 | boydgreenfield | (And is EMytype still desired for Exceptions or are folks moving towards MyTypeException?) |
18:28:42 | boydgreenfield | Varriount: Ah — was looking and had troulbe finding that on nimrod-lang.org. Thanks! |
18:28:59 | * | Machielo joined #nimrod |
18:29:00 | Araq | boydgreenfield: MytypeError |
18:29:17 | Varriount | boydgreenfield: I really need to publish that in the repo or something, and host it on the Website directly, along with all the other docs. |
18:31:24 | boydgreenfield | Varriount: Not a problem, just wasn’t sure where to find it. How should one plan for the switch to the standard library? E.g., `BitarrayError* = object of EBase` will become what exactly? (Or perhaps items such as TSlice are better examples) |
18:31:24 | * | Machielo quit (Read error: Connection reset by peer) |
18:32:03 | Varriount | boydgreenfield: I've no idea. dom96 still uses prefixes in his additions to the stdlib, I don't. |
18:32:11 | * | Machielo joined #nimrod |
18:32:20 | Araq | don't bother, nimrod pretty will fix it automatically |
18:32:29 | Varriount | Hi Machielo |
18:32:41 | boydgreenfield | Araq: Great. Thx. |
18:33:11 | OrionPK | Use of extra whitespace for alignment is discouraged |
18:33:15 | OrionPK | ^ boo |
18:33:18 | OrionPK | definitely boo. |
18:33:18 | Machielo | Hi Varriount! :) |
18:33:20 | OrionPK | disagree |
18:33:26 | * | ics joined #nimrod |
18:33:56 | Varriount | OrionPK: It messes with diffs, not everyone has an editor that supports auto-alignment, it's tedius to hand-align. |
18:34:21 | Varriount | OrionPK: But remember, that's only for the stdlib. You do what you want with your own private projects. |
18:35:08 | OrionPK | hand align |
18:35:21 | OrionPK | just do hand alignment if it makes the code more readable |
18:38:11 | * | BitPuffin joined #nimrod |
18:39:09 | Varriount | OrionPK: "It's tedius to hand-align" |
18:40:02 | OrionPK | if it takes you 5 seconds to hand align something and it makes it 5 times more readable, then it's worth it |
18:41:44 | Varriount | OrionPK: Give me a community consensus. |
18:42:20 | OrionPK | give me a community consensus the other way around |
18:42:52 | Machielo | stupid question: how does "hand alignment" differ from "use of extra whitespace for alignment" ? |
18:43:13 | Machielo | in that there's no specified rule like "4 spaces per indent block"? |
18:43:55 | Varriount | Machielo: Not that kind of alignment |
18:45:29 | Demos | I don't think code alignment can make anything 5x more readable |
18:46:10 | Machielo | ah like the alignment of data in type declarations and so on? |
18:46:12 | OrionPK | it definitely can |
18:46:15 | Machielo | not code indentation |
18:46:17 | Machielo | got it |
18:46:25 | OrionPK | it can be indentation Machielo |
18:46:44 | Varriount | Machielo: https://gist.github.com/Varriount/14c0234e5f9a5c9ef1d3 |
18:47:21 | OrionPK | https://gist.github.com/onionhammer/cdcda4a7370b258fbe66 |
18:47:25 | Machielo | thanks got it! |
18:51:53 | Araq | Varriount: er ... the style guide is nice but |
18:51:56 | flaviu | OrionPK: Also messes up diffs |
18:52:16 | Araq | lacks the essential questions of what to do with FooObj vs FooRef |
18:52:30 | OrionPK | flaviu how is that? |
18:52:46 | OrionPK | whose tool is going to change people's spacing automatically? |
18:52:53 | flaviu | If you add a variable that has a longer name, you'll have to realign everything |
18:53:34 | flaviu | Regardless, I do use alignment in places where it helps make obvious the structure of the program. |
18:55:23 | flaviu | Like https://gist.github.com/a7f98a4fd63b4b3866bd |
19:00:10 | Varriount | Araq: Ok, what do we do about FooObj vs FooRef? |
19:00:50 | Araq | Varriount: Foo for the "primary" usage, FooRef/FooObj for the other |
19:01:07 | Araq | if there is no primary usage, it should be Foo and FooRef |
19:01:23 | Araq | (and FooPtr of course) |
19:01:45 | flaviu | in .net, there doesn't seem to be any convention differentiating structs and classes |
19:01:52 | Varriount | Araq: So a plain name for whatever version of the object will be used the most, and an Obj/Ref suffix for the less used version? |
19:02:03 | Araq | exactly |
19:02:17 | Varriount | Sounds sensible. |
19:02:24 | Araq | flaviu: yeah and I don't really like that, but *shrug* |
19:03:02 | flaviu | I don't really like the idea of providing a `FooRef` object, `ref Foo` is just as good |
19:03:22 | Araq | Varriount: also mention the T/P/E/F convention and that -while deprecated- there still is lots of code around using this convention |
19:03:32 | Araq | flaviu: but it isn't |
19:03:46 | Araq | type FooRef = ref Foo not nil # for instance |
19:04:06 | Araq | (ref Foo)(x: 1) is uglier than FooRef(x: 1) |
19:04:09 | Araq | etc. |
19:04:26 | flaviu | Araq: You already know my thoughts on (ref Foo)(x:1) |
19:04:29 | flaviu | But those conventions do sound perfectly reasonable, I can put up with them without problem |
19:04:41 | flaviu | The not nil is a good point |
19:06:41 | dom96 | Varriount: what kind of extra whitespace for alignment are you talking about in the NEP? |
19:06:42 | * | Machielo quit (Read error: Connection reset by peer) |
19:06:53 | flaviu | dom96: https://gist.github.com/Varriount/14c0234e5f9a5c9ef1d3 |
19:06:55 | dom96 | Isn't aligning the proc params basically that? |
19:07:06 | dom96 | oh |
19:07:14 | flaviu | dom96: Nope, you can change the length of parameter names without realignment |
19:07:17 | dom96 | He may want to clarify that in the wiki |
19:07:23 | * | Machielo joined #nimrod |
19:07:42 | Varriount | Araq: Is there a term for the way enum members can be referenced without mention of the actual enum name? |
19:07:52 | flaviu | Hungarian notation? |
19:07:54 | dom96 | flaviu: you can? |
19:08:22 | dom96 | flaviu: oh wait. I'm thinking of proc names. |
19:08:56 | flaviu | I think its worth that hassle there too, as proc names don't change too often. |
19:09:26 | flaviu | And its a bit of "punishment" for having a proc that takes too many params |
19:09:29 | dom96 | well I disagree with the multi-procedure call style |
19:09:36 | dom96 | the latter should be used all the time IMO |
19:10:14 | flaviu | dom96: I think it'd get too cluttered |
19:11:00 | * | kunev joined #nimrod |
19:11:01 | flaviu | and with named parameters especially, version 1 is best because its easy to make out each parameter |
19:11:59 | * | Fx00F joined #nimrod |
19:18:24 | * | ics quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
19:19:28 | boydgreenfield | dom96: FYI, just added a package for you :) |
19:21:02 | NimBot | nimrod-code/packages master 778230e Nick Greenfield [+0 ±1 -0]: Add bitarray to packages.json |
19:21:02 | NimBot | nimrod-code/packages master d8cedd2 Dominik Picheta [+0 ±1 -0]: Merge pull request #70 from refgenomics/master... 2 more lines |
19:21:05 | dom96 | boydgreenfield: thanks |
19:23:34 | boydgreenfield | dom96: To you as well. |
19:23:52 | * | BitPuffin quit (Ping timeout: 240 seconds) |
19:24:26 | Varriount | Araq: How should exceptions be named? |
19:24:57 | Araq | Varriount: FooError |
19:25:18 | * | kunev quit (Ping timeout: 250 seconds) |
19:28:00 | fowl | going to define my favorite errors |
19:28:33 | fowl | UnspecifiedError, UnknownError, UndeterminsticError |
19:28:37 | flaviu | While the renaming is going on, can someone sneak in an InvalidArgumentError? |
19:34:03 | adoniscik | what's the easiest way to define a proc whose arguments can be one of several types? If I define a new type T = T1 or T2 etc. I find that compiler only accepts parameters that are uniformly equal to the same subtype Ti of T, while I want them all to be allowed to be different, so long as they are in T. |
19:34:03 | * | Machielo quit (Read error: Connection reset by peer) |
19:34:20 | * | BitPuffin joined #nimrod |
19:34:35 | * | Machielo joined #nimrod |
19:35:09 | flaviu | adoniscik: How about proc foo[T]? when something isn't what you want, it will give a undefined symbol error |
19:35:48 | adoniscik | when you use T won't all arguments of type T have to be equal |
19:36:00 | flaviu | Oh, I see what you mean |
19:36:18 | def- | adoniscik: foo[T1,T2] ? |
19:36:23 | adoniscik | that doesn't scale well |
19:36:25 | flaviu | I'm not sure thats possible though, since I have that exact same issue when using unsigned types |
19:36:58 | adoniscik | did you discuss this with the crew? |
19:37:49 | adoniscik | I want to be able to allow certain numerical types for which certain operations like addition and multiplication are defined. I don't care if it's an int or a float, for example. |
19:38:03 | adoniscik | so I say T = int or float |
19:38:21 | adoniscik | but I want to be able to freely mix ints and floats, not just ints or just floats, which is what I get with T = int or float |
19:38:30 | def- | adoniscik: T1, T2 = int or float? |
19:39:18 | adoniscik | I guess, but you have to define as many Ts as you have arguments. It seems somewhat hackish to me, don't you think? |
19:39:49 | def- | also it's "T: int or float" I think |
19:39:54 | flaviu | You also have to convert to homogeneous types to actually do the operations |
19:41:59 | * | pafmaf joined #nimrod |
19:43:14 | def- | adoniscik: actually you even need proc x[T1: int or float, T2: int or float](a: T1, b: T2) |
19:43:20 | def- | which really isn't all that nice, hm |
19:43:36 | adoniscik | I'm trynig sometihngh like that right now and it's not wokring |
19:43:47 | Fx00F | zcant you have a macro do that for you? |
19:43:55 | def- | adoniscik: working for me |
19:44:10 | adoniscik | I think a template not macro is called for, Fx00F ? |
19:44:17 | Fx00F | probably |
19:44:36 | Fx00F | I'm not that familiar with nimrod |
19:44:54 | adoniscik | me neither :) |
19:45:49 | adoniscik | def-, I get a type mismatch when I try to call it |
19:46:11 | adoniscik | wait a sec |
19:48:06 | adoniscik | all right, please look at http://pastebin.com/cPeufNbY |
19:48:16 | adoniscik | the *= operation fails |
19:49:39 | def- | float(c) in line 3 |
19:49:57 | def- | or no |
19:50:01 | def- | T2(c) |
19:50:20 | adoniscik | good one |
19:50:27 | def- | and also, you can't echo an array |
19:50:31 | adoniscik | I thought float <-> int would be automatic |
19:50:33 | def- | because $ is not defined |
19:50:45 | adoniscik | thanks, I took care of that elsewhere but forgot to include the code for you |
19:50:50 | def- | ok |
19:51:03 | adoniscik | so float <> int is not handled automatically? |
19:51:30 | def- | only int constants are automatically seen as floats when it's a float parameter I think |
19:52:46 | def- | apart from that no |
19:52:46 | * | Machielo quit (Read error: Connection reset by peer) |
19:53:58 | * | Machielo joined #nimrod |
19:55:04 | Varriount | adoniscik, Fx00F: FYI, you can use repr() on most things to get a string representation of an otherwise non-stringifiable type. |
19:55:09 | adoniscik | If I want to define a shorthand for float or int so I can shorten foo[T1: int or float, T2: int or float, ...] what are my options? |
19:55:56 | Varriount | adoniscik: type Number = float or int |
19:56:10 | def- | Varriount: which unexpectedly doesn't work. I'm currently filing a bug |
19:56:14 | Varriount | I think. |
19:56:14 | adoniscik | didn't work for me, Varriount |
19:56:16 | Varriount | Odd. |
19:56:28 | adoniscik | first thing I tried :) |
19:56:29 | flaviu | Don't type parameters also have shorthand as [T1, T2: int or float]? |
19:56:36 | Varriount | flaviu: Yeah. |
19:56:42 | def- | flaviu: but then both are the same type |
19:56:51 | def- | flaviu: always both int or both float |
19:57:08 | flaviu | Really? That seems unexpected |
19:57:23 | Varriount | adoniscik: You could try a hack and use a template filter |
19:57:58 | adoniscik | I'm just learning templates, please can you show how? |
20:00:09 | Varriount | https://gist.github.com/Varriount/7459eee0a7197cb71140 |
20:00:12 | Araq | adoniscik: ignoring the compiler's bugs, what you want to achieve is called a C++ism |
20:00:28 | Araq | lots of complexity for nothing ;-) |
20:00:59 | Araq | so ... uh I can't mix numeric types and pretend types don't matter? who cares |
20:01:16 | Varriount | Araq: I think adoniscik cares. :/ |
20:01:54 | Fx00F | Araq: you hate math so deeply |
20:02:03 | adoniscik | well, Araq, for the purposes of the algorithm it doesn't. If I define multiplication between ints and floats, I sholdn't have to spell out all four permutations |
20:02:32 | adoniscik | and that's with just two arguments |
20:02:39 | Araq | yeah well and I thought you can only multiply 2 floats anyway |
20:03:09 | Araq | int*float makes no sense |
20:03:12 | Araq | at all. |
20:03:18 | Araq | Fx00F: in math. |
20:03:38 | flaviu | adoniscik: A converter from int to float maybe? |
20:03:38 | adoniscik | you can upgrade the int to a float then |
20:03:47 | Fx00F | I guess it depends on what * means |
20:03:48 | adoniscik | but if both arguments are ints, you shold stick to insts |
20:04:08 | * | ARCADIVS joined #nimrod |
20:04:23 | Varriount | adoniscik: Then you can do what flaviu suggested... |
20:04:27 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
20:05:19 | flaviu | adoniscik: You can get that. proc foo[T: int or float], and converter int2Float(i: int): float =... |
20:05:54 | Varriount | "Nimrod: Have one obvious way of doing things, and multiple fallbacks" |
20:07:29 | Varriount | Anyone know of a way I could shorten a heading "Conventions for multi-line statements and expressions"? |
20:07:49 | adoniscik | delete the first two words? |
20:09:44 | Araq | btw you can do: type Number = distinct int|float |
20:09:50 | Araq | proc foo(a, b: Number) |
20:09:56 | Araq | foo(3, 2.0) |
20:10:02 | Araq | iirc |
20:10:07 | * | bjz joined #nimrod |
20:10:14 | adoniscik | oh that's intersting, let me give it a try |
20:10:33 | Varriount | Araq: But then he loses all the operators. |
20:10:41 | def- | Araq: no |
20:10:49 | Araq | no? |
20:11:01 | def- | Araq: doesn't work, just seems to work, because the 3 argument is automatically made a float |
20:11:29 | Araq | no ... how would that work? |
20:11:48 | Araq | looking at the 2nd argument before the first to widen it to float? |
20:11:54 | def- | sorry, other way around |
20:12:01 | def- | with 3, 2.0 it doesn't work at all |
20:12:11 | def- | with 2.0, 3 it seems to work, but it's just 2 floats |
20:12:31 | Araq | ah ok, well try: |
20:12:39 | Araq | proc foo(a: Number, b: Number) |
20:12:49 | def- | doesn't work |
20:13:04 | def- | bugreport here btw: https://github.com/Araq/Nimrod/issues/1385 |
20:14:25 | Fx00F | def-: hi, I found another case where the usual/normal nimbrod code is slower than optimized c |
20:14:42 | Fx00F | this time with hash tables |
20:15:04 | def- | Fx00F: hi |
20:15:39 | Araq | Fx00F: hash tables are crap for benchmarks unless you use the same hashing algorithms |
20:16:04 | flaviu | Fx00F: TBH, nimrod's hash tables and hash algorithms aren't very good |
20:16:17 | Araq | you might as well compare it to a binary tree otherwise |
20:16:17 | Fx00F | then nimrod is probably using a slow algorithm |
20:16:22 | Araq | and yes |
20:16:30 | Araq | we never optimized hashing |
20:17:17 | flaviu | Fx00F: I think the main issue is that the bits in the hash function aren't randomly distributed. |
20:17:32 | Fx00F | and newSeq's insertions? I found that to be slower than c(using a library for dynamic vectors) |
20:18:04 | Varriount | Fx00F: Did you compile using -d:release? |
20:18:28 | Fx00F | Varriount: yes |
20:18:46 | Varriount | Fx00F: What C library were you using? |
20:18:49 | flaviu | gist the nimrod version of the benchmark please? |
20:19:11 | Fx00F | https://github.com/attractivechaos/klib |
20:20:57 | * | ehaliewicz joined #nimrod |
20:21:12 | dom96 | Araq: Is there a way I can force the use of the general `$` for objects when I have a specific `$` defined for the object? |
20:21:35 | Araq | system.`$` |
20:21:42 | Fx00F | flaviu: is hastebin ok? |
20:21:58 | flaviu | Fx00F: Sure, I use gist because I have a terminal app to do it for me |
20:22:02 | flaviu | Whatever is convienet |
20:22:19 | Fx00F | what terminal app? and do I need a gist account? |
20:22:25 | dom96 | Araq: thanks |
20:22:32 | * | brson joined #nimrod |
20:22:36 | dom96 | Araq: How's the bug fixing going? |
20:22:48 | * | dom96 is going through bugs too |
20:22:55 | flaviu | Fx00F: gist is part of your github account, but don't worry about it unless you want to |
20:23:13 | flaviu | I use https://github.com/defunkt/gist |
20:24:11 | Varriount | dom96: What bugs are you working on? |
20:25:02 | dom96 | Currently https://github.com/Araq/Nimrod/issues/1065 |
20:25:42 | Fx00F | flaviu: will take me some time, but I think it's better in the long run |
20:26:55 | Araq | wait what?! parseUrl("http://localhost/") / parseUrl("foo") / parseUrl("bar") == "http://localhost/bar" ?! |
20:27:22 | Araq | and we should implement this insane RFC? why? |
20:27:22 | * | Machielo quit (Read error: Connection reset by peer) |
20:27:23 | dom96 | Araq: I know right? |
20:27:32 | dom96 | Araq: Not to worry, I am implementing it sanely :P |
20:27:35 | Araq | with a bit of luck this RFC is dead already |
20:27:48 | dom96 | We'll have `&` and `/` |
20:27:57 | dom96 | for URLs |
20:27:58 | Araq | seriously ... people who can't code are writing these "specs" |
20:28:14 | * | Machielo joined #nimrod |
20:28:20 | flaviu | Araq: How is the spec specifying that? |
20:28:48 | flaviu | NM, I see |
20:28:50 | Araq | RFC 3986, apparently |
20:29:33 | dom96 | http://tools.ietf.org/html/rfc3986#section-5.2.2 |
20:29:44 | dom96 | There is the algorithm |
20:31:40 | * | Ven joined #nimrod |
20:31:41 | * | Machielo quit (Read error: Connection reset by peer) |
20:32:17 | flaviu | I don't see where he got that example, it is obviously wrong |
20:32:26 | * | Machielo joined #nimrod |
20:32:30 | flaviu | parseUrl("http://localhost/") / parseUrl("foo") / parseUrl("/bar") == "http://localhost/bar" is correct |
20:33:07 | Araq | well that's hardly better |
20:33:25 | flaviu | Actually, he's right, and it makes sense |
20:33:40 | dom96 | In practice it's annoying. |
20:33:51 | Araq | it's error prone, flaviu |
20:33:54 | flaviu | foo is a file name, you can't go deeper. When going to bar, you are navigating to a file named bar |
20:33:55 | dom96 | In order to get it right you must ensure that you have your leading/trailing slashes right |
20:33:58 | dom96 | Which is a huge PITA |
20:34:13 | flaviu | No other way to ensure lack of ambiguity |
20:34:52 | Varriount | I ran into a similar problem setting up an apache proxy the other day. |
20:35:21 | Araq | DO NOT IMPLEMENT THIS, or else give a name like correctByTheSpecButBraindeadCombine |
20:35:47 | flaviu | It isn't braindead, its the correct way, if you understand what the url actually means |
20:36:24 | flaviu | How can you navigate a file? It isn't a directory |
20:36:40 | Araq | why should "foo" be a file? |
20:36:47 | Araq | it's simply a name |
20:36:55 | flaviu | By omitting the trailing slash, that's what you're saying |
20:37:00 | Varriount | Speaking of a long procedure name, what should the the style rule dictate when a procedure declaration has both a really long name and a really long list of arguments, such that the normal style of starting the arguments on a new line at the column of the opening brace doesn't work? |
20:37:26 | Araq | Varriount: indent 2 spaces after the ( |
20:37:38 | * | Machielo quit (Quit: WeeChat 0.4.3) |
20:37:51 | dom96 | Araq: I'm thinking `&` vs. `/`. I guess you won't like that. |
20:38:00 | Araq | yup. |
20:38:03 | flaviu | generically constructing hashes is hard :( |
20:38:35 | flaviu | Especially how to decide the key size |
20:38:43 | Varriount | What kind of hash do python's dictionaries use? |
20:38:57 | flaviu | Varriount: I'm not looking for that |
20:39:00 | Araq | Varriount: ask Jehan when he's around |
20:39:09 | flaviu | Varriount: SipHash I think |
20:39:16 | Araq | he wrote python's dict implementation, I think |
20:39:27 | flaviu | Yep, siphash |
20:39:39 | dom96 | Araq: What do you suggest then? |
20:39:50 | Varriount | Araq: Do you mean, he wrote python's dict implementation in Nimrod, or that he wrote the original python implementation of dictionaries? |
20:39:51 | flaviu | Varriount: http://legacy.python.org/dev/peps/pep-0456/ |
20:40:02 | Araq | dom96: '/' vs obscureCombine |
20:40:22 | Araq | Varriount: the python version |
20:40:40 | dom96 | Araq: i'll name it 'combine' |
20:40:45 | flaviu | I think that implementing the spec is first priority. Otherwise, things are unexpected |
20:41:09 | Varriount | Araq: You don't like specifications? |
20:41:19 | Araq | the spec itself is unexpected and nobody reads it, flaviu |
20:41:28 | dom96 | Yeah, look at stackoverflow for proof |
20:41:38 | Araq | Varriount: I like specs that make sense |
20:41:39 | dom96 | Plenty of questions confused by this behaviour |
20:41:45 | Araq | these are hard to come by though |
20:43:02 | Araq | also I don't believe in specs. Is MacOS X compatible with Posix? ha, ha, ha |
20:43:19 | * | Machielo joined #nimrod |
20:43:33 | Araq | and if so with which version of Posix? |
20:43:44 | Araq | Posix is a moving target |
20:45:08 | flaviu | dom96: I can't find any relevant questions |
20:45:34 | Varriount | Araq: Option one or option two -> https://gist.github.com/Varriount/1bd3f5da3e4b4907c72b |
20:45:55 | dom96 | http://stackoverflow.com/questions/1795917/path-part-gets-overwritten-when-merging-two-uris |
20:46:40 | flaviu | Varriount: https://gist.github.com/flaviut/9d239aca007a036dbde8 |
20:47:14 | Araq | dom96: I would really name it obscureCombine |
20:47:14 | Varriount | flaviu: Or that. But how will the procedure body look? |
20:47:17 | flaviu | dom96: All I have to say there is that I don't know what he expected |
20:47:28 | Machielo | gnight everyone! |
20:47:34 | Varriount | Good night. |
20:47:35 | * | Machielo left #nimrod (#nimrod) |
20:47:35 | Araq | Machielo: bye |
20:47:39 | flaviu | There is no way that url could be interpreted in any other way |
20:48:38 | * | Fx00F quit (Ping timeout: 240 seconds) |
20:48:39 | Araq | dom96: in fact, I wouldn't implement it all. Can't see a useful use case |
20:48:39 | flaviu | And there were only two people who weren't shaking their heads while navigating away. |
20:49:06 | dom96 | Araq: Too bad. I already spent my time doing it. |
20:50:37 | Varriount | flaviu: I don't know, they guy's assumptions make sense - that's what I would assume. |
20:50:45 | * | Fx00F joined #nimrod |
20:50:47 | Araq | I think our HTML parser should yell if the DOCTYPE is wrong/missing and then stop parsing |
20:51:04 | Araq | that will teach people to write correct HTML |
20:51:26 | flaviu | Varriount: A relative url starting with `/foo` is relative to the hostname, always. |
20:51:59 | Araq | hmm "a relative URL starting with /" |
20:52:04 | dom96 | flaviu: The point is that when I am building a URL I really don't care about this stuff. |
20:52:05 | Araq | spot the error |
20:52:38 | dom96 | And then programmers are forced to use string concat. |
20:52:48 | flaviu | Araq: I don't see it |
20:52:51 | dom96 | and hope that they don't end up with no slashes or two slashes |
20:53:57 | flaviu | I can't really believe I'm arguing about `/foo`, even wordpress plugin devs know about that stuff. |
20:54:22 | Araq | flaviu: that itself is not what people expect from Unix paths |
20:54:45 | flaviu | Araq: Of course it is. Unix paths have no hostname |
20:54:54 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
20:54:55 | Araq | /foo is an absolute path |
20:55:26 | flaviu | Araq: file:///foo is an absolute path |
20:55:43 | flaviu | For URIs, the scheme is non-optional |
20:55:47 | Araq | I'm pretty sure that came later |
20:56:28 | flaviu | It did, but we're arguing about URLs, not path specifiers |
20:56:40 | Araq | but /foo is not what we're arguing about |
20:56:47 | Varriount | dom96: The other option is to have one procedure that takes a parameter dictating behavior |
20:57:02 | Araq | "foo" without slash is what we're arguing about |
20:57:26 | Varriount | proc combine(a, b: string, op = Relaxed): string |
20:57:29 | * | Fx00F quit (Ping timeout: 256 seconds) |
20:57:30 | dom96 | http://example.org/foo/ vs. http://example.org/foo |
20:57:42 | Araq | meh ... I don't want to argue anymore |
20:58:01 | dom96 | That's gotta be one of the most annoying things. |
20:58:06 | dom96 | That stupid trailing slash. |
20:58:25 | Araq | you can either care about human beings or about the spec |
20:58:33 | Araq | pick your poison |
20:58:34 | dom96 | and that affects relative URLs |
20:58:47 | flaviu | Final argument then: The spec should be met, even when it isn't intuitive for the beginner |
20:58:49 | dom96 | Varriount: That hides the issue IMO |
20:58:58 | * | Fx00F joined #nimrod |
20:59:11 | dom96 | flaviu: It will be met. |
20:59:14 | * | Ven joined #nimrod |
20:59:38 | flaviu | Araq: Basically the same argument as your math rant: Experienced users don't care, new users have no influence over things |
20:59:39 | Varriount | dom96: But it puts the responsibility of decision with the user, not the designer. |
20:59:40 | dom96 | If I can stop watching TI |
20:59:52 | dom96 | Varriount: huh> |
20:59:53 | dom96 | *? |
21:00:04 | Fx00F | flaviu: it's 7 files, should I use gist anyway? |
21:00:04 | dom96 | Varriount: If you have separate functions the user decides too no? |
21:00:11 | Varriount | dom96: Yep. |
21:00:25 | flaviu | Fx00F: Sure, I think that `gist *.nim` works |
21:00:26 | Varriount | dom96: But then you end up with naming weirdness. |
21:00:48 | dom96 | a default argument is too implicit |
21:01:21 | flaviu | dom96: I think that & is a reasonable compromise. |
21:01:39 | Fx00F | https://gist.github.com/4eb265c3d05787d56ecb |
21:01:40 | flaviu | or even &/ |
21:01:42 | dom96 | flaviu: Well, Araq wants 'obscureCombine' |
21:02:00 | Fx00F | I included 2 files from that library |
21:02:02 | dom96 | I will name it 'combine' |
21:03:03 | Araq | flaviu: the whole point of computers is to assist human beings, not transform human beings into thinking like a computer |
21:03:19 | Araq | programmers usually have to do the latter |
21:03:30 | Araq | but that's nothing that you celebrate |
21:05:00 | Araq | now go tell Google that they generate invalid HTML ... 'cause they care ... |
21:07:00 | flaviu | I'm sure google has made the page to use as few bytes as possible or something |
21:07:21 | flaviu | Which is in my book good reason to break the spec |
21:07:51 | Varriount | Fx00F: What happens when you put the code in the sequence benchmark in a main() procedure? |
21:08:27 | Varriount | Fx00F: Globals reside in shared memory, thus there's a penalty for accessing them. |
21:08:56 | Araq | flaviu: yes, everybody has good reasons. Except me, of course. |
21:09:06 | * | ics joined #nimrod |
21:09:20 | * | Varriount just had a feeling of deja-vu |
21:09:23 | flaviu | Noob convenience is not a good reason |
21:09:26 | Fx00F | Varriount: in resize.c? what do you mean? it's all in main |
21:09:44 | flaviu | Fx00F: What should I be benchmarking? resize.nim? |
21:09:46 | Varriount | Fx00F: No, in resize.nim |
21:10:11 | Fx00F | I see no main() in resize.nim |
21:10:33 | Varriount | Fx00F: Exactly. There should be one, if you're benchmarking. |
21:10:40 | def- | Fx00F: it's still a 32 bit int in nimrod and a 64 bit int in C |
21:10:45 | Araq | flaviu: *convenience* is a good reason. |
21:10:48 | def- | eh, other way around * |
21:11:07 | Araq | it's one of the best reasons there is |
21:11:27 | Varriount | Demos: ping |
21:11:37 | flaviu | When you are designing the spec, yes. When you are writing a library that advertises to be by the spec, no. |
21:11:53 | Araq | we don't advertise to adhere to the spec |
21:12:02 | Araq | we advertise to be useful and friendly |
21:12:18 | Demos | Varriount, pong |
21:13:24 | flaviu | Fair enough, I value convention much more highly than you do then |
21:13:46 | Varriount | Demos: Do you remember what snippet you used to benchmark a windows program's total execution time? |
21:14:02 | Varriount | Demos: It invoked powershell through the command prompt, IIRC |
21:14:23 | * | Fx00F quit (Ping timeout: 250 seconds) |
21:14:53 | Demos | use the Measure-Command commandlet |
21:15:05 | Varriount | Demos: Ah, thanks. |
21:15:05 | Demos | so like @powershell Measure-Command ... I think |
21:15:23 | Varriount | powershell -command |
21:15:41 | flaviu | Lol, the bottleneck for seqs is in an if statement |
21:15:42 | flaviu | https://github.com/Araq/Nimrod/blob/ed226eba6dab432ba47f3bb6e4a6b3b1dea64330/lib/system/sysstr.nim#L191 |
21:16:27 | * | Fx00F joined #nimrod |
21:16:44 | flaviu | Fx00F: Found the bottleneck I think: https://github.com/Araq/Nimrod/blob/ed226eba6dab432ba47f3bb6e4a6b3b1dea64330/lib/system/sysstr.nim#L191 |
21:16:47 | Fx00F | those time outs... how do I add main to nimrod? |
21:17:00 | def- | Fx00F: proc main() = ... |
21:17:12 | def- | Fx00F: and then: when isMainModule: main() |
21:17:18 | def- | but i tried and got no speedup |
21:17:43 | Varriount | flaviu: So what is the C vector implementation doing differently? |
21:17:50 | Araq | it doubles the memory |
21:17:53 | flaviu | I dunno, I haven't looked there |
21:17:54 | Araq | nimrod's doesn't |
21:18:14 | Araq | nimrod's does * 1.5 |
21:18:37 | Varriount | But shouldn't that result in less time? |
21:18:50 | flaviu | Araq: That's taking practiclly no time at all |
21:19:09 | def- | Araq: when i make it double the seq it's only 10% faster, but the C one is still 5 times as fast |
21:19:15 | Varriount | flaviu: How did you find the bottlenck? |
21:19:24 | Araq | def-: what? |
21:19:32 | flaviu | http://i.imgur.com/rRx3Qvt.png |
21:20:00 | flaviu | Varriount: callgrind profiler and kcachegrind GUI |
21:20:15 | Varriount | Aww.. No Windows solution for me.. T_T |
21:20:48 | def- | Araq: i just changed resize() in sysstr.nim to double instead of * 1.5 |
21:20:53 | def- | to check if that's it |
21:20:56 | flaviu | growobject is also taking a while, make it inline? |
21:21:14 | flaviu | The call is taking a while, not the proc |
21:21:37 | Araq | flaviu: that's the GC cleaning up old seqs then |
21:21:56 | Araq | perhaps |
21:22:10 | Fx00F | and btw, the 2nd number in the benchmark in makefile is memory usage |
21:22:22 | def- | is it maybe because the C one uses realloc instead of a new alloc? |
21:22:50 | def- | (I don't know if realloc does any magic) |
21:23:00 | flaviu | That wouldn't be a 5x improvement |
21:23:09 | flaviu | 3x, maybe |
21:23:18 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
21:23:22 | flaviu | 15% of the time is spent copying |
21:23:48 | flaviu | http://i.imgur.com/9nPARY3.png |
21:24:43 | Araq | well realloc can expand the heap, we can't do the same |
21:25:09 | Araq | but that only affects benchmarks, in the real world you rarely have only a single growing array |
21:25:54 | * | q66 quit (Remote host closed the connection) |
21:26:20 | Varriount | Wait, so deallocation of old seqs is taking up time? |
21:26:24 | def- | the C one only calls memcpy once? |
21:26:37 | * | ehaliewicz quit (Remote host closed the connection) |
21:26:48 | flaviu | Varriount: deallocation is free pretty much |
21:27:01 | flaviu | 0% of the time taken |
21:27:30 | * | q66 joined #nimrod |
21:27:51 | Araq | flaviu: so the CPU can't predict result.len >= result.space ? |
21:28:11 | Araq | I surely can predict that one... |
21:29:54 | Fx00F | also, the nimbrod version is taking 2x as much ram (probably the grouth schedule) |
21:30:12 | flaviu | I think its getting predicted correctly, but its just really hot, so its taking a while |
21:30:43 | flaviu | 34 or something true out of 10,000,000 false should be easy to predict |
21:32:16 | def- | For me it seems like this is entirely thanks to realloc |
21:32:30 | def- | when I make the C example use malloc instead it is exactly as fast as Nimrod |
21:32:58 | Araq | Fx00F: well you have a seq[int] which can be a seq[int64] depending on your cpu |
21:33:10 | Araq | for C you use int32 |
21:34:01 | Fx00F | Araq: I changed it to uint64_t in the c version |
21:34:48 | flaviu | lol, I've inlined literally every function in the program, and it seems to be slower! |
21:35:08 | Araq | def-: grow 2 seqs in both benchmarks and realloc's advantage should vanish |
21:35:16 | Araq | well "should" |
21:35:33 | def- | Araq: nice idea, i'll try |
21:35:47 | Araq | these micro benchmarks are always weird |
21:35:51 | Fx00F | in nimrod, int and int64 take the same memory, and int32 doesnt seem to exist |
21:35:58 | def- | Fx00F: sure exists |
21:36:50 | Fx00F | ok, exists, doesnt compile: resize.nim(4, 5) Error: type mismatch: got (seq[int32], int) |
21:37:03 | flaviu | The range variable is an int |
21:37:05 | def- | Araq: nope, no difference |
21:37:13 | flaviu | try 1'i32..1000000'i32 |
21:37:47 | Araq | def-: well find out why realloc is so fast then :P |
21:37:55 | def- | magic! |
21:37:56 | Araq | so that we can perhaps learn from it |
21:38:51 | * | BitPuffin quit (Ping timeout: 256 seconds) |
21:40:02 | def- | oh wait, i think I just tested the wrong executable. these files shouldn't both be named resize =/ |
21:40:22 | Fx00F | def-: are you not using the makefile? |
21:40:56 | Araq | flaviu: it makes no sense unless you have a cache miss in the 'if' |
21:41:26 | flaviu | Its just executed a lot. This isn't going to be representitive of real code |
21:42:05 | flaviu | I don't have a fancy i7 with its pipeline, it might make a bigger difference for me than others |
21:42:36 | Fx00F | flaviu: me neither |
21:42:46 | Araq | well but a[i] = x is executed as often as the 'if' |
21:43:06 | Araq | it's as "hot" and yet it doesn't show up |
21:45:07 | Fx00F | we chould use the same grouth schedule in both |
21:45:53 | dom96 | Varriount: Use cygwin |
21:46:27 | Araq | Fx00F: well iirc we claim a good performance vs speed of development ratio and not that GC'ed nimrod code runs as fast as C |
21:46:29 | flaviu | Araq: I can't even find the line that does the assignment |
21:47:36 | Fx00F | Araq: maybe you dont caim that, but others definiely do |
21:47:57 | * | BitPuffin joined #nimrod |
21:48:06 | Fx00F | eg https://nimrod-by-example.github.io |
21:49:04 | OrionPK | that says c++ not c |
21:49:07 | * | Trustable quit (Quit: Leaving) |
21:49:22 | Fx00F | that c code probably runs in a c++ compiler |
21:49:23 | flaviu | Only because I was too lazy to type out more words |
21:50:46 | flaviu | Araq: And the assignment is about as slow |
21:51:21 | flaviu | I see a bunch of movs in the assembler, I think that's it |
21:52:02 | Araq | Fx00F: well obviously you can import realloc from C and get the same times :P |
21:52:18 | Araq | or rather import that C library that you use |
21:53:02 | Fx00F | but is that "easy"? that library uses macros extensively |
21:53:06 | Araq | or to make the point more fair: reimplement it in Nimrod and get the same speed |
21:53:15 | flaviu | Araq: BTW, I'm not blaming you for not caring about performance in this case. |
21:54:41 | Araq | Fx00F: what's your point? it's not "easy" to use in C either. nothing is. |
21:54:44 | flaviu | And you have a couple good excuses: "Its a microbenchmark, irrelevant since real workloads do more work than an increment", and "Nimrod isn't fully mature, performance may not yet be ideal" |
21:56:08 | Araq | flaviu: hey, I do care about this benchmark |
21:56:40 | flaviu | I guess you have to use the second excuse then |
21:56:45 | flaviu | :P |
21:57:18 | Araq | where do we say "idiomatic Nimrod code always performs the same as C"? |
21:58:18 | Araq | and what does that mean anyway? btw Ada is often faster than C |
21:58:31 | Fx00F | Araq: calling an external c functio from nimrod is easy, but is it as easy to pass macro parameters to a bunch of c code and then call that c function you get from the preprocessor? |
21:58:42 | flaviu | Ada doesn't have the same reputation as C |
21:59:25 | flaviu | When someone says "Ada", you think "airplanes". When someone says "C", you think "hardcore systems programming" |
21:59:49 | flaviu | Fx00F: Should be easy to port those macros into nimrod |
22:05:20 | Fx00F | flaviu: I woulndt know how, I could give it a try when I know more nimrod |
22:06:33 | Fx00F | but actually my motivation was to test how nimrod's standar library, which is based on ideas similar to that c library, compares to said lib |
22:08:44 | Araq | Fx00F: tbh a comparison against C++ would be more interesting to me |
22:09:04 | Fx00F | why? |
22:10:06 | Varriount | Fx00F: Probably because whenever you try to google something C related, you end up getting results for nothing but C++ |
22:10:14 | flaviu | Araq: Another feature request, a way of telling the GC the length of a unchecked array |
22:10:17 | * | boydgreenfield quit (Quit: boydgreenfield) |
22:10:50 | Varriount | flaviu: Can't you do that without the GC? |
22:11:04 | flaviu | Sure, but it wouldn't work with object refrences |
22:11:15 | Varriount | Huh? |
22:11:19 | * | Jesin quit (Quit: Leaving) |
22:11:21 | Fx00F | Varriount: google is bad at that, not my fault |
22:11:37 | Araq | Fx00F: because this C library shows again why C++ was a good idea ;-) |
22:11:52 | Varriount | "Idea" being the operative word. |
22:11:54 | Fx00F | ^^ |
22:12:24 | flaviu | Varriount: I can't have an unchecked array of ref T and have integration with the GC. My objects would be collected prematurely |
22:12:45 | Varriount | flaviu: GC_ref and GC_unref? |
22:13:10 | flaviu | Really? That works? |
22:13:25 | * | Fr4n quit (Ping timeout: 256 seconds) |
22:13:33 | Araq | for some definition of "works" |
22:14:00 | flaviu | Does it lead to neither dangling pointers or memory leaks? |
22:14:15 | Araq | it leads to manual memory management |
22:14:29 | flaviu | I can confine it to just part of the program, right? |
22:14:49 | Varriount | Hm. Also, there's unsafeNew, although I don't know how references are dealt with for something like that. |
22:15:34 | flaviu | I can alloc the array, no problem. My problem is with ref Ts |
22:16:27 | Varriount | flaviu: Also, I must ask, why use arrays, and not seqs? |
22:16:46 | flaviu | I'm implementing that cool thing everyone just saw beating nimrod |
22:16:59 | * | Jesin joined #nimrod |
22:17:04 | Fx00F | ^^ |
22:17:20 | Araq | Varriount: there is no RFC for seqs so he doesn't trust them |
22:17:34 | Varriount | Araq: Pft, stop being petty. |
22:18:08 | Fx00F | can I talk about performance as often as you talk about standars? |
22:18:42 | * | Jesin quit (Read error: Connection reset by peer) |
22:19:31 | Araq | Fx00F: yes |
22:19:53 | Fx00F | :) |
22:21:52 | Varriount | flaviu: Look at it this way - if your resort to manual memory management, your not doing anything the C benchmark isn't doing already. |
22:22:23 | flaviu | I can stick the manual memory management out of sight, its a layer of abstraction |
22:22:47 | Araq | flaviu: usually that's exactly what you can't do |
22:23:03 | flaviu | Araq: What file is the GC code in? |
22:23:27 | Araq | gc.nim |
22:23:39 | flaviu | not gc2.nim? ok |
22:25:21 | * | boydgreenfield joined #nimrod |
22:25:36 | * | Fr4n joined #nimrod |
22:26:12 | * | Jesin joined #nimrod |
22:27:13 | Fx00F | those leadin spaces in gc.nim look awful in my vim |
22:27:22 | * | Ven joined #nimrod |
22:30:02 | * | q66 quit (Remote host closed the connection) |
22:30:21 | Araq | Fx00F: we don't clean those up because the resulting git diffs are annoying |
22:31:02 | Fx00F | fair enough |
22:31:14 | * | q66 joined #nimrod |
22:31:31 | * | q66 quit (Remote host closed the connection) |
22:32:53 | * | q66 joined #nimrod |
22:33:16 | flaviu | Araq: Skimming over the relevant code, where do you get the size information for seqs? |
22:33:48 | Araq | flaviu: in 2 places but forget it |
22:33:59 | Araq | you won't get that feature anytime soon |
22:34:54 | flaviu | It was technically your idea :P "Future directions: GC'ed memory should be allowed in unchecked arrays and there should be an explicit annotation of how the GC is to determine the runtime size of the array." |
22:36:59 | dom96 | we should make sure not to add any more leading spaces though. |
22:37:11 | Fx00F | can I safely remove csources/c_code folder? |
22:37:26 | flaviu | Fx00F: Sure |
22:38:10 | Varriount | dom96: We could have nimbot merge pull requests manually for us, and run them through nimrod pretty |
22:38:53 | Araq | flaviu: can't you work on something important instead? |
22:39:37 | flaviu | I am. I'm just tired of endians |
22:40:07 | * | q66 quit (Remote host closed the connection) |
22:41:11 | * | q66 joined #nimrod |
22:41:12 | dom96 | Varriount: We could have nimbot do many things. |
22:41:21 | flaviu | The thing is, I want to be able to say "Nimrod is as fast as C, and it has automatic memory management." |
22:41:38 | * | boydgreenfield quit (Quit: boydgreenfield) |
22:42:06 | Demos | what was the problem? |
22:42:11 | Demos | was it just using more memory? |
22:42:37 | flaviu | And 5x slower, although it was a very micro microbenchmark |
22:43:45 | Araq | flaviu: ok but how do ref arrays help with that? |
22:44:44 | * | Jehan_ joined #nimrod |
22:45:10 | Fx00F | flaviu: s/as fast as C/ as fast and memory efficient as C/ |
22:46:34 | flaviu | Fx00F: Never going to be as memory efficent as C, garbage collection has a fixed overhead |
22:46:48 | Fx00F | and probably some applications will still have manual memory management (eg, if it ever repalces fortran in HPC) |
22:47:23 | flaviu | Araq: In that benchmark it isn't, but in the general case, people aren't going to use it if they have to manage their own memory |
22:47:25 | Jehan_ | If anything ever replaces Fortran in HPC, it's going to have manual memory management. :) |
22:47:38 | Jehan_ | Fortran already has quite a few mechanisms to avoid manual memory management. |
22:49:35 | Jehan_ | flaviu: "Fast as C" is one of the most meaningless statements in the world. |
22:50:18 | flaviu | Jehan_: Maybe so, but its good marketing |
22:50:41 | * | boydgreenfield joined #nimrod |
22:50:43 | Jehan_ | flaviu: Yes, but that's not at odds with it being stupid. In fact, a lot of good marketing is stupid. |
22:51:17 | * | pafmaf quit (Quit: Verlassend) |
22:51:18 | Demos | also you can always construct a benchmark that C fails pretty hard at |
22:51:43 | Fx00F | Demos: not with numrod |
22:51:50 | Fx00F | nimrod |
22:52:21 | Demos | well you may be able to get some situation where nimrod can emit restricts that would be annoying for a human |
22:52:31 | flaviu | Demos: C has inline assembler I think, so take your fancy fast program and feed it into the inline assembler |
22:52:48 | Demos | flaviu, that hardly counts |
22:52:51 | Demos | and nimrod has that too |
22:53:09 | flaviu | :P. It technically counts, and that's all that matters |
22:53:49 | Jehan_ | Well, and Nimrod can {.emit.} C code, too, so by that token, Nimrod can always precisely match C performance ... |
22:54:12 | Fx00F | sure, nimbrod has the potential to genetate "faster than the usual hand written C code" |
22:54:32 | flaviu | Great, I can say that "Nimrod is as fast as C for all possible programs" |
22:54:43 | Demos | right which is all that really matters |
22:54:48 | Fx00F | same as C does that with assembly, usually |
22:54:57 | Demos | yeah, exactly |
22:54:58 | flaviu | Kidding of course |
22:55:24 | flaviu | But what was the initial topic? |
22:55:59 | Fx00F | memory? |
22:56:14 | Araq | the topic was "why the 2 words of overhead for seqs are unacceptable for flaviu" |
22:56:23 | Jehan_ | The thing is that when you actually compare idiomatic C to idiomatically written code in other compiled languages, C is not necessarily faster. |
22:57:02 | Jehan_ | Because the lack of abstraction power you have in C can lead to pretty inefficient designs. |
22:57:10 | Jehan_ | Where, e.g., you copy data more than is necessary. |
22:57:16 | flaviu | Araq: Its not necessary the two words, its that I can't make my own seq, even if exactly the same. |
22:59:09 | Araq | Jehan_: the excessive 'ifs' everywhere for error checking would be my number one source of inefficiency in C programs |
22:59:27 | flaviu | The language provides the bare minimum, the libraries provide the abstraction. But if the libraries are an integral part of the language, with no clear separation, there is a problem. |
22:59:51 | Jehan_ | Araq: There's no inherent need to program defensively. |
22:59:57 | Fx00F | Araq: that's what #ifdefs are for |
23:01:20 | Demos | flaviu, well C does not provide tools for abstraction at all |
23:02:00 | flaviu | Demos: I never said C was ideal |
23:02:54 | Araq | flaviu: so let me get this straight ... when seqs are built-in that's bad but when arrays are that's not? |
23:03:26 | flaviu | I'd be happy with a pointer and a way to tell the GC its type too |
23:03:51 | Araq | no, builtin pointers means the language is not expressive enough to have pointers as a library type |
23:03:59 | * | darkf joined #nimrod |
23:04:31 | flaviu | I'm not going to argue with that |
23:04:48 | flaviu | I'd agree, but you have to draw the arbitrary line somewhere |
23:05:06 | Demos | why not just have a ptr and then gc_root stuff on add and gc_unroot on del |
23:05:39 | flaviu | That wouldn't hide the memory management from clients of the library |
23:05:50 | Demos | why not |
23:07:32 | flaviu | Because a ref is passed to be stored, not a ptr |
23:08:09 | Demos | right you have proc add*(item: ref) = gc_root(item) ... |
23:08:10 | Jehan_ | flaviu: What are you trying to do? |
23:08:47 | flaviu | C kicked Nimrod's ass in a benchmark, I want to implement a new vector type for nimrod |
23:08:47 | Demos | actually you would use gc_ref |
23:09:07 | Jehan_ | flaviu: What benchmark? |
23:09:19 | Demos | also, benchmark seqs aganst c++'s std::vector<T> |
23:09:25 | flaviu | https://gist.github.com/4eb265c3d05787d56ecb |
23:09:55 | flaviu | Jehan_: make nimrod_resize, compare with make c_resize |
23:10:50 | Jehan_ | flaviu: Since the C benchmark doesn't have garbage collection, I'd simply suggest doing a GC-free implementation to match it. /shrug |
23:11:03 | flaviu | Jehan_: I don't want to do this halfway |
23:11:11 | Varriount | Whats the difference, besides performance, between the C and Nimrod versions? |
23:11:13 | Demos | flaviu, are you actually using b for anything? |
23:11:25 | flaviu | Demos: b? |
23:11:33 | Demos | the seq called b |
23:12:09 | Demos | also do you know that nimrod's countTables are as fast as this khash thing |
23:12:15 | flaviu | Its not my code |
23:12:24 | flaviu | but it doesn't appear that b is being used |
23:13:55 | Fx00F | flaviu: 5x performance? did you fix the c version to use 32 bits ints? |
23:14:03 | Fx00F | s/32/64 |
23:15:02 | Demos | did you profile |
23:15:10 | flaviu | Demos: Yes |
23:15:18 | flaviu | Fx00F: Oh, only 3x then |
23:15:24 | flaviu | :/ |
23:16:57 | Fx00F | still willing to make nimrod faster? |
23:17:35 | Demos | I bet nimrod could be fixed, the benchmark looks suspect |
23:17:46 | Demos | I mean nimrod is allocateing a big ass seq while c is not |
23:17:53 | Jehan_ | flaviu: The C benchmark is faster simply because realloc() does not need to copy memory. |
23:18:22 | Jehan_ | When I ran it and printed pointers before and after reallocing, that happened only once. |
23:18:23 | flaviu | Jehan_: Let me benchmark again, I don't think thats it |
23:19:25 | Jehan_ | Typical microbenchmark behavior that you won't see in a real program with a heap that's actually being used for more than one thing. |
23:19:46 | flaviu | Jehan_: copying memory takes just 10% of the time |
23:20:50 | flaviu | Jehan_: http://i.imgur.com/S3R8kwB.png |
23:21:32 | * | Fr4n quit (Ping timeout: 245 seconds) |
23:23:57 | Araq | looks like the optimizer fails to keep the important thing in a register |
23:24:04 | * | 5EXAAABOS quit (Ping timeout: 250 seconds) |
23:24:25 | Demos | also that looks like it may be profiled with gperf |
23:24:31 | flaviu | Inlining everything actually makes things worse |
23:24:36 | flaviu | Demos: callgrind |
23:24:38 | Jehan_ | flaviu: Well, incrSeq contains the code to grow the sequence. |
23:24:52 | Demos | callgrind runs on a virtual CPU right? |
23:25:06 | Araq | flaviu: well you need to do the inling properly |
23:25:33 | flaviu | Jehan_: Here you go: http://i.imgur.com/WcTemPy.png |
23:26:52 | * | adoniscik quit (Ping timeout: 245 seconds) |
23:28:16 | Araq | try it with a local L and setLen(a, L+1); a[L] = x; inc(L) |
23:28:23 | Fx00F | Demos: probably does random sampling, like stopping a debugger at random points, but no idea how |
23:31:29 | Jehan_ | flaviu: I think your profiler is broken. |
23:31:40 | flaviu | Fx00F: Actually, I think Demos is right. |
23:32:07 | Fx00F | does it slow down the code a lot? |
23:32:08 | flaviu | Jehan_: Possibly, do you have any recommendations? |
23:32:17 | Jehan_ | I ran it with Instruments, and runtime was completely dominated by memmove and bzero. |
23:32:21 | flaviu | Fx00F: Yes |
23:33:18 | Jehan_ | http://imgur.com/dwGqx4B |
23:33:51 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
23:34:46 | Jehan_ | flaviu: My recommendation is to do nothing. In a real program, realloc() won't give you that benefit. |
23:43:38 | * | io2 quit (Quit: ...take irc away, what are you? genius, billionaire, playboy, philanthropist) |
23:56:02 | * | vendethiel quit (Remote host closed the connection) |
23:57:40 | * | vendethiel joined #nimrod |
23:57:49 | * | boydgreenfield quit (Quit: boydgreenfield) |