Re: Faster please....
Screw it, I give up....
!!!!!!
----- Original Message -----
From: "Euman" <euman at bellsouth.net>
To: <EUforum at topica.com>
Subject: Re: Faster please....
>
>
> From: "C. K. Lester" <euphoric at cklester.com>
>
> > Euman wrote:
> >
> > > snip
> > Please strip the "3D" extraneous characters, Euman.
> >
>
> Sorry, Hope this one gets to you without the 3D's...
>
> <snip>
>
> global function sDelimited1(sequence s1, sequence s2)
> integer len, start, endx
> sequence dseq,dl -- didn't define dl
> dseq=3D{} -- didn't initialize this
>
> len =3D length(s2)
> start =3D 1
> for i =3D 1 to len do
> if equal(s2[i..i],s1) then
> endx =3D i - 1
> dseq &=3D {s2[start..endx]}
> start =3D i + 1
> end if
> end for
> return dseq
> end function
>
>
> function sNest(sequence s1, sequence s2)
> integer start, endx
> sequence dseq
>
> dseq =3D {}
> start =3D 1
> for i =3D 1 to length(s1) do
> endx =3D s1[i]
> dseq &=3D {s2[start..endx-1]}
> start =3D endx + 1
> end for
> return dseq
> end function
>
> function sDelimited( sequence s1, sequence s2 )
> -- returns: sequence containing indices of all matches
> -- if unsuccessful return empty sequence {}
> object found
>
> found =3D match( s1, s2 )
> if found then
> found &=3D found + sDelimited( s1, s2[found+1..length(s2)] )
> else
> return {}
> end if
> return found
> end function
>
> ----------- test function ---------
> sequence dl, test
> object data
> integer stop
> atom t
>
> dl=3Drepeat(127,1)
>
> t =3D time()
> for i =3D 1 to 10000 do
> test =3D "Euman"&dl&"Euphoria"&dl&"Programmer"&dl&"this is a test"&dl
>
> -- comment / uncomment
> --data=3DsNest(sDelimited("=7F", test), test)
> data=3DsDelimited1("=7F", test)
>
> end for
> t =3D time() - t
> puts(1, sprintf("%2.3f", t)&'\n')
>
>
> for i=3D1 to 4 do
> puts(1, data[i]&'\n')
> end for
> stop=3Dgetc(0)
>
> </snip>
>
> Euman
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>
|
Not Categorized, Please Help
|
|