From: skaller <sk...@us...> - 2004-07-29 21:37:51
|
On Fri, 2004-07-30 at 06:18, Brian Hurt wrote: > On Thu, 29 Jul 2004, Nicolas Cannasse wrote: > Yep. You've hit the nail on the head- and here is where we part company. > I will gladly sacrifice a fair bit of performance for design cleanliness. Nah, there is no conflict! "Trust me" the cleanest and most elegant and correct design WILL also be the fastest :) What I suspect is .. to get performance, it WILL be necessary to have more than one module: either you use RTTI like dynamic checking such as 'fast_count', to gain speed dynamically, or you provide the bifurcation in the interface. The point is that there IS a 'kind' distinction, the semantics aren't the same for lists and streams. There simply isn't any possible way to get high performance and correct behaviour for both kinds without bifurcation, the choice is simply whether to make the split statically or at run time. I prefer a static split if possible, however this may lead to a combinatorial explosion of kinds, which is sometimes better handled dynamically (where you can navigate the combination tree in time instead of exploding your code base infinitely ..) I actually think Nicolas has the right attitude -- "its broke but I cant see a really good alternative so I won't fix it" -- but in email I think it comes across more hardline than he intends. BTW: at least part of the problem is Ocaml itself. Ocaml makes a limited number of choices at run time, to provide a unified static interface. Unfortunately, that's really hard to specialise when you want better performance for some cases -- such as arrays of unboxed float. In fact C++ handles this far better than Ocaml, since specialisation is builtin and fundamental to the whole template concept. -- John Skaller, mailto:sk...@us... voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net |