loops & perfomace

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

This is a multi-part message in MIME format.

------=_NextPart_000_0005_01C0CFDA.F95FD000
	charset="iso-8859-2"

Hi,
i've got an performace question. We've got a loop

for i=3D1 to length(s) do
       ...
end for

is length(s) evaluated every time loop is done? So would be in Euphoria =
faster

l=3D length(s)
for i=3D1 to l do
    ...
end for

as i read in one C book?


------=_NextPart_000_0005_01C0CFDA.F95FD000
Content-Type: text/html;
	charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-2" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3D"Arial CE" size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3D"Arial CE" size=3D2>i've got an performace question. =
We've got a=20
loop</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2>for i=3D1 to length(s) =
do</FONT></DIV>
<DIV><FONT face=3DCourier=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2>end for</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D"Arial CE" size=3D2>is length(s) evaluated every time =
loop is=20
done? So would be in Euphoria faster</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2>l=3D length(s)</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2>for i=3D1 to l do</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2>&nbsp;&nbsp;&nbsp; ...</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2>end for</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D"Arial CE" size=3D2>as i read in one C =
book?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D"Arial CE"=20

------=_NextPart_000_0005_01C0CFDA.F95FD000--

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

Search



Quick Links

User menu

Not signed in.

Misc Menu