Re: type string

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

Well, from my benchmarking, this is an OK type, although with longer =
strings it does rise to 3rd place--behind Jeff's string6 (with Mike's =
modification) at 2nd place, and Gabriel's string12 in 1st.

Christopher, are you using Daniel's benchmark program? I haven't used =
that yet, I think it might help if I started though...

BTW - Gabriel, I'm impressed by your string type, but... what made you =
think to redefine the parameter? I didn't even know that that was =
possible in Euphoria  (and I'm not sure I like it, although in this case =
a definite speed benefit is there.)


Rod Jackson

----------
From:   ddhinc[SMTP:ddhinc at ALA.NET]
Sent:   Wednesday, March 17, 1999 2:17 PM
To:     EUPHORIA at LISTSERV.MUOHIO.EDU
Subject:        Re: type string

Hi,
  I couldn't resist jumping in on an optimization race:)
This one runs a bit faster in my tests, especially for
longer sequences.

-----------------------------------------------
global type string13(object x)

   if atom(x) then
      return 0
   end if

   -- ensure all elements are in the range 0 to 255
   if compare(x, and_bits(255, x)) then
      return 0
   end if

   -- ensure there's no sub-sequences
   for i =3D 1 to length(x) do
      if not integer(x[i]) then
         return 0
      end if
   end for
   return 1
end type
-----------------------------------------------

Have fun,
Christopher D. Hickman

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

Search



Quick Links

User menu

Not signed in.

Misc Menu