Re: type string
- Posted by Roderick Jackson <rjackson at CSIWEB.COM> Mar 16, 1999
- 470 views
Whoa! That's nice! Over 18% speed increase (over 35% for long strings.) You know, this all started as a question, and took off into a fairly = profitable intellectual exercise... I'm really learning a lot from all = of this. I think we need to gather all of these speed-boosting tips together; I = know I didn't see THIS one in the Euphoria docs. Rod Jackson ---------- From: Mike[SMTP:michael at IGRIN.CO.NZ] Sent: Tuesday, March 16, 1999 1:54 AM To: EUPHORIA at LISTSERV.MUOHIO.EDU Subject: Re: type string Hey guys, why not try using: if c < 0 then return 0 elsif c > 255 then return 0 end if instead of: if (c < 0) or (c > 255) then return 0 end if I seem to recall that in the ABS() wars the multi IF block was faster = than the single-liner code. (compare the function fast_lower() in C:\Euphoria\Bin\Search.ex ) michael at igrin.co.nz -----Original Message----- From: Boehme, Gabriel <gboehme at MUSICLAND.COM> To: EUPHORIA at LISTSERV.MUOHIO.EDU <EUPHORIA at LISTSERV.MUOHIO.EDU> Date: Tuesday, March 16, 1999 8:52 AM Subject: Re: type string >Daniel Berstein <daber at PAIR.COM> wrote: > >>>Running on a PII 200mHz in DOS under WinNT: >>> ------------------------------------------- >>>exw strbench 100000 6 >>> >>>string6z() - 0.001285 "c<0" replaced with "c<1" >>>string6() - 0.001288 >>>string6s() - 0.001304 "not sequence(s)" replaced with "atom(s)" >>>string6i() - 0.001324 "integer(c)" replaced with "atom(c)" >>>string() - 0.001344 >>> > >[snip] > >>BTW I avoided some of the randomness of the benchmark under NT using >>exw.exe instead of ex.exe (and the numbers returned are much more = "real" >>than those 0.00xxx seconds ex.exe gives). > > >You're right: > >Running EXW in WinNT: > --------------------- >exw strbench 400000 6 > >string8 -- 5.890000 almost identical to string6 [see below] >string6i -- 6.020000 "integer(c)" replaced with "atom(c)" >string -- 6.096667 >string6z -- 6.165000 "c<0" replaced with "c<1" >string6 -- 6.173333 >string8i -- 6.241667 almost identical to string6i [see below] >string6s -- 6.273333 "not sequence(s)" replaced with "atom(s)"