modified reverse

new topic     » topic index » view thread      » older message » newer message

Rob:
The following modified reverse routine is simpler and, most of the times,
slightly faster than the standard one. However, I noticed that the
comparison between the two is affected by the type of data (integer or not,
simple or compound sequence), and even it seems that the way of generating
the data (by means of a single sentence or by a loop) affects the resulting
timings. Any explanation for such a behavior?

global function reverse1(sequence s)
    integer n
    sequence t
    n = length(s)
    t = repeat(0,n)
    for i = 1 to n do
        t[n] = s[i]
        n -= 1
    end for
    return t
end function

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu