asserts aren't compiled into release builds (except assert(false)). So, if the loop only contains asserts, the compiler *should* be able to strip out the loop altogether. I don't know if DMD actually does that, though.

Or you could use debug statements:

    debug foreach (x; largeArray) {

        ...
    }

you'll need to compile with "-debug" for the loop to be included.

Reply via email to