Re: loops & perfomace

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

Probally because Eu saves the data from length into an int, but
doesn't for the eu-integer type.

P.S. Off topic from message thread, anyone know any good guis for "Euphoria
for Linux"?

jbrown

On Sun, Apr 29, 2001 at 02:34:42AM +1000, Derek Parnell wrote:
>=20
>=20
> With the quick test I did below, the times seem to say that length() is
> faster than integer! But only one tenth of a second over 67 million
> iterations. So I would worry about it.
>=20
> ---------------
> atom e
>=20
> integer aa
> sequence ss, x
>=20
> ss =3D "jhsdkjahsh akshdkjahsdkjaskjdaskhjdakjsdhkjashdkjahskdjhaksjdhkas=
dh"
> x=3D{}
> aa =3D length(ss)
> e =3D time()
> for j =3D 1 to 1000000 do
> for i =3D1 to length(ss) do
>     x =3D append(x,ss)
>     x =3D {}
> end for
> end for
>=20
> ? time() - e
> ? aa
> ---------------
>=20
> ------
> Derek Parnell
> Melbourne, Australia
> "To finish a job quickly, go slower."
>=20
> ----- Original Message -----
> From: martin.stachon at worldonline.cz
> To: EUforum
> Sent: Saturday, April 28, 2001 8:01 PM
> Subject: loops & perfomace
>=20
>=20
>=20
> Hi,
> i've got an performace question. We've got a loop
>=20
> for i=3D1 to length(s) do
>        ...
> end for
>=20
> is length(s) evaluated every time loop is done? So would be in Euphoria
> faster
>=20
> l=3D length(s)
> for i=3D1 to l do
>     ...
> end for
>=20
> as i read in one C book?
>=20
> ----------------------------------------
>=20
>=20
>=20
>=20
>=20
> =3D=3D^=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
>=20
<snip>


--=20
Linux User:190064
Linux Machine:84163
http://jbrown105.1avenue.com

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

Search



Quick Links

User menu

Not signed in.

Misc Menu