Boost logo

Boost :

From: Thomas Holenstein (tholenst_at_[hidden])
Date: 2000-05-31 04:24:09

Fernando Luis Cacciola Carballal writes:
> The idea is simple, the compiler will generate N lines of the
> particular form of the operation, so no loop is used. I've tested
> this and its really faster than any kind of iteration. The drawback,
> though, is that it might get too larger for big Ns.

I don't think I like this. After all, a compiler is expected to do
exactly that if you say it to unroll the loops. And he probably knows
better which loops to unroll.

If you explicitly unroll the loops this way, you may have a large code
bloat, especially if you have fixedarrays of different sizes.

A collegue of mine suggested to have a unrolling loop template for all
functions, so may be making a function would make your approach much
easier anyhow.

So one could write

arry<int,3 > a = { { 1, 2, 3} };
unrolled_loop(a, 3, negate);

or such a thing, thus having full control over unrolled loops as user.


Boost list run by bdawes at, gregod at, cpdaniel at, john at