Enrico,

This is a good idea.

regards,
Eduardo


--- Em sáb, 11/6/11, Enrico Maria Giordano <[email protected]> 
escreveu:

> De: Enrico Maria Giordano <[email protected]>
> Assunto: [xHarbour-developers] StrTran() speedup
> Para: "xHarbour Developers Mailing List" 
> <[email protected]>
> Data: Sábado, 11 de Junho de 2011, 6:51
> Dear friends, look at the following
> sample:
> 
> FUNCTION MAIN()
> 
>     LOCAL cShort := SPACE( 100 )
>     LOCAL cLong  := SPACE( 1024 * 1024 )
> 
>     LOCAL nSec
> 
>     LOCAL i
> 
>     nSec = SECONDS()
> 
>     FOR i = 1 TO 200000
>         cShort = STRTRAN( cShort,
> "TEST", "ABCDEFG" )
>     NEXT
> 
>     ? SECONDS() - nSec
> 
>     nSec = SECONDS()
> 
>     FOR i = 1 TO 200000
>         IF AT( "TEST", cShort ) > 0
>             cShort = STRTRAN(
> cShort, "TEST", "ABCDEFG" )
>         ENDIF
>     NEXT
> 
>     ? SECONDS() - nSec
> 
>     nSec = SECONDS()
> 
>     FOR i = 1 TO 1000
>         cLong = STRTRAN( cLong, "TEST",
> "ABCDEFG" )
>     NEXT
> 
>     ? SECONDS() - nSec
> 
>     nSec = SECONDS()
> 
>     FOR i = 1 TO 1000
>         IF AT( "TEST", cLong ) > 0
>             cLong = STRTRAN(
> cLong, "TEST", "ABCDEFG" )
>         ENDIF
>     NEXT
> 
>     ? SECONDS() - nSec
> 
>     INKEY( 0 )
> 
>     RETURN NIL
> 
> The results on my PC are:
> 
>  0.33
>  0.16
> 10.86
>  3.38
> 
> So I wonder if we can speedup StrTran() just add the AT()
> test inside 
> StrTran() C level code.
> 
> Let me know if it can be done and if it is a good idea.
> 
> EMG
> 
> --
> EMAG Software Homepage:     http://www.emagsoftware.it
> The EMG's ZX-Spectrum Page: http://www.emagsoftware.it/spectrum
> The Best of Spectrum Games: http://www.emagsoftware.it/tbosg
> The EMG Music page:     
>    http://www.emagsoftware.it/emgmusic 
> 
> 
> ------------------------------------------------------------------------------
> EditLive Enterprise is the world's most technically
> advanced content
> authoring tool. Experience the power of Track Changes,
> Inline Image
> Editing and ensure content is compliant with Accessibility
> Checking.
> http://p.sf.net/sfu/ephox-dev2dev
> _______________________________________________
> xHarbour-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/xharbour-developers
> 

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
xHarbour-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xharbour-developers

Reply via email to