1. RE: New rtrim()

Igor,

Thanks for the suggestion.  I tried it in putsxy.e and didn't see any 
improvement in performance, so for the moment I'll stick with Jiri's 
original version.

Colin Taylor


Igor Kachan wrote:
> Dear Eu users,
> 
> There is the rtrim() function in
> the putsxy.e lib.
> 
> This function removes zeros from
> the end of a sequence.
> 
> New rtrim_() function makes the
> same thing about 30% faster 
> and is more simple.
> 
> --
> function rtrim_(sequence s)
>            for i=length(s) to 1 by -1 do
>           if s[i] then 
>    return s[1..i] end if end for
>    return {} 
> end function
> --
> 
> Use it please if you need such a function.
> 
> Regards,
> Igor Kachan
> kinz at peterlink.ru
> 
>

new topic     » topic index » view message » categorize

2. RE: New rtrim()

Igor Kachan wrote:

> 
> Yes, Colin, this function is not the noticeable
> one for the putsxy.e perfomance.
> 
> But try please the test below.
> 

Igor,

Your test program always returns an empty sequence instead of a slice,
because your test sequences contain only zeros.  This isn't a realistic 
test, and it gives you an artificially fast score for your version of 
rtrim().  If you make the test more realistic, with the majority of test 
sequences containing some non-zero values, you will find that both 
rtrim() have about the same speed.

However, your code is shorter and easier to understand, which in my book 
counts for a lot.

Regards,  Colin

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu