Re: Passing arguments a template parameters vs. function parameters

2013-06-11 Thread John Colvin
On Tuesday, 11 June 2013 at 22:13:18 UTC, bearophile wrote: If you want to do benchmarks don't forget to do them with a better compiler, like LDC2, that is able to use that compile-time information to optimize better. When I have written that code I was using only DMD. I have just started t

Re: Passing arguments a template parameters vs. function parameters

2013-06-11 Thread bearophile
Craig Dillabaugh: If I had been coding this I would almost certainly have passed the splitting dimensions as a function parameter, since the compiler has to generate separate makeTree/findMedian functions for each dimension that i/idx takes in the program. So my question is, does anyone have an

Re: Passing arguments a template parameters vs. function parameters

2013-06-11 Thread Craig Dillabaugh
On Tuesday, 11 June 2013 at 21:26:35 UTC, John Colvin wrote: On Tuesday, 11 June 2013 at 20:46:32 UTC, Craig Dillabaugh wrote: I was looking at D code for constructing kd-trees, the full code listing for which can be found here: clip So my question is, does anyone have any idea why the aut

Re: Passing arguments a template parameters vs. function parameters

2013-06-11 Thread John Colvin
On Tuesday, 11 June 2013 at 20:46:32 UTC, Craig Dillabaugh wrote: I was looking at D code for constructing kd-trees, the full code listing for which can be found here: http://rosettacode.org/wiki/K-d_tree#Faster_Alternative_Version Of particular interest were the following functions: KdNode* m

Passing arguments a template parameters vs. function parameters

2013-06-11 Thread Craig Dillabaugh
I was looking at D code for constructing kd-trees, the full code listing for which can be found here: http://rosettacode.org/wiki/K-d_tree#Faster_Alternative_Version Of particular interest were the following functions: KdNode* makeTree(size_t dim, size_t i)(KdNode[] nodes) pure nothrow { i