1. optimization....help

------=_NextPart_000_0014_01C03AE9.698838E0
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello all,

Can the below loop be optimized further?

I know that takeing the multiplies out should do it
but am at a lose on this.......

----- begin -----------

count =3D 1=20
across =3D 262
down =3D 236

seq =3D repeat(0,down)  =20
=20
for x =3D 1 to down do   =20
    seq[x] =3D r[count..across * x]=20
    count  =3D across * x + 1
end for

--- end -------------------

euman at bellsouth.net


------=_NextPart_000_0014_01C03AE9.698838E0
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4207.2601" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hello all,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Can the below loop be optimized=20
further?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I know that takeing the multiplies out =
should do=20
it</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>but am at a lose on =
this.......</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>----- begin -----------</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>count =3D 1 </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>across =3D 262</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>down =3D 236</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;</DIV></FONT>
<DIV><FONT face=3DArial size=3D2>seq =3D=20
<DIV><FONT face=3DArial size=3D2>for x =3D 1 to down =
do&nbsp;&nbsp;&nbsp;=20
<BR>&nbsp;&nbsp;&nbsp; seq[x] =3D r[count..across * x] =
<BR>&nbsp;&nbsp;&nbsp;=20
count&nbsp; =3D across * x + 1</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>end for</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>--- end =
-------------------</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><A=20

------=_NextPart_000_0014_01C03AE9.698838E0--

new topic     » topic index » view message » categorize

2. Re: optimization....help

On Fri, 20 Oct 2000 22:59:33 -0400, Euman <euman at BELLSOUTH.NET> wrote:

>Can the below loop be optimized further?

  How can anyone optimize an example when they
  don't know what sequence r is ?
  what type of variables you are using, or
  what you are trying to accomplish, etc.

new topic     » goto parent     » topic index » view message » categorize

3. optimization....help

------=_NextPart_000_002A_01C03AEF.51D54520
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Found on the net..........

Programmers tend to over-estimate the usefulness of the programs they =
write. The approximate value of an optimization is:=20

    number of runs =D7 number of users =D7 time savings =D7 user's =
salary - time spent optimizing =D7 programmer's salary

even if the program will be run hundreds of times by thousands of users, =
an extra day spent saving 40 milliseconds probably isn't going to help.=20



euman at bellsouth.net




------=_NextPart_000_002A_01C03AEF.51D54520
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4207.2601" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<P>Found on the net..........
<P>Programmers tend to over-estimate the usefulness of the programs they =
write.=20
The approximate value of an optimization is: <PRE>    number of runs =D7 =
number of users =D7 time savings =D7 user's salary - time spent =
optimizing =D7 programmer's salary
</PRE>
<P>even if the program will be run hundreds of times by thousands of =
users, an=20
extra day spent saving 40 milliseconds probably isn't going to help. =
</P>
<P>&nbsp;</P>
<P><A href=3D"mailto:euman at bellsouth.net">euman at bellsouth.net</A></P>

------=_NextPart_000_002A_01C03AEF.51D54520--

new topic     » goto parent     » topic index » view message » categorize

4. optimization....help

------=_NextPart_000_0045_01C03AF0.C980D700
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Bernie wrote:

How can anyone optimize an example when they
  don't know what sequence r is ?
  what type of variables you are using, or
  what you are trying to accomplish, etc.

well, r is a sequence obviously across * down
of 0's or 1's or 61,832 bytes long.




------=_NextPart_000_0045_01C03AF0.C980D700
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4207.2601" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Bernie wrote:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>How can anyone optimize an example when they<BR>&nbsp; don't know =
what=20
sequence r is ?<BR>&nbsp; what type of variables you are using, =
or<BR>&nbsp;=20
what you are trying to accomplish, etc.</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>well, r is a sequence obviously across =
*=20
down</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>of 0's or 1's or 61,832 bytes =
long.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>

------=_NextPart_000_0045_01C03AF0.C980D700--

new topic     » goto parent     » topic index » view message » categorize

5. Re: optimization....help

Euman, this will be somewhat faster:

for x = 1 to down do
     seq[x] = r[count..across]
     count  = across + 1
     across += 262
end for

jiri


>From: Euman <euman at BELLSOUTH.NET>
>Reply-To: Euphoria Programming for MS-DOS <EUPHORIA at LISTSERV.MUOHIO.EDU>
>To: EUPHORIA at LISTSERV.MUOHIO.EDU
>Subject: optimization....help
>Date: Fri, 20 Oct 2000 22:59:33 -0400
>
>Hello all,
>
>Can the below loop be optimized further?
>
>I know that takeing the multiplies out should do it
>but am at a lose on this.......
>
>----- begin -----------
>
>count = 1
>across = 262
>down = 236
>
>seq = repeat(0,down)
>
>for x = 1 to down do
>     seq[x] = r[count..across * x]
>     count  = across * x + 1
>end for
>
>--- end -------------------
>
>euman at bellsouth.net
>

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at
http://profiles.msn.com.

new topic     » goto parent     » topic index » view message » categorize

6. Re: optimization....help

Thanks Jiri

my mistake was @ across += 262 where I added
across again where 262 is now...........

< \Kick myself>


----- Original Message -----
From: "jiri babor" <jiri_babor at HOTMAIL.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Saturday, October 21, 2000 2:09 AM
Subject: Re: optimization....help


> Euman, this will be somewhat faster:
>
> for x = 1 to down do
>      seq[x] = r[count..across]
>      count  = across + 1
>      across += 262
> end for
>
> jiri
>
>
> >From: Euman <euman at BELLSOUTH.NET>
> >Reply-To: Euphoria Programming for MS-DOS <EUPHORIA at LISTSERV.MUOHIO.EDU>
> >To: EUPHORIA at LISTSERV.MUOHIO.EDU
> >Subject: optimization....help
> >Date: Fri, 20 Oct 2000 22:59:33 -0400
> >
> >Hello all,
> >
> >Can the below loop be optimized further?
> >
> >I know that takeing the multiplies out should do it
> >but am at a lose on this.......
> >
> >----- begin -----------
> >
> >count = 1
> >across = 262
> >down = 236
> >
> >seq = repeat(0,down)
> >
> >for x = 1 to down do
> >     seq[x] = r[count..across * x]
> >     count  = across * x + 1
> >end for
> >
> >--- end -------------------
> >
> >euman at bellsouth.net
> >
>
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
> Share information about yourself, create your own public profile at
> http://profiles.msn.com.
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu