[phobos] compile time algorithms from std.typetuple

David Nadlinger code at klickverbot.at
Fri Apr 19 14:21:07 PDT 2013


Hi Khurshid,

On Fri, Apr 19, 2013 at 1:22 PM, Khurshid Normuradov
<khurshid.normuradov at gmail.com> wrote:
> Why more linear algorithms implemented as O(N^2)?
> example: staticMap, or staticIndex,  Erase, EraseAll, and etc..
> see hello.d file.

Well, the algorithms are simply implemented in the most
straightforward way, which is head/tail resp. car/cdr style. Many
people (myself included) tend to switch their brains to functional
programming mode when doing template metaprogramming, and slicing
isn't included in that scheme.

Your approach to reducing the number of "total template arguments"
from O(n²) to O(n log(n)) is interesting, and indeed seems to lead to
speedups for operations on large tuples. Could you maybe put together
some performance numbers and post a pull request for further review?

David


More information about the phobos mailing list