TruerWords Logo
Google
 
Web www.truerwords.net

Search TruerWords

Welcome
Sign Up  Log On

“RE: Optimize Your UserTalk: Remove Extra Variables”

From: Seth Dillingham In Response To: 3064  Re: Optimize Your UserTalk: Remove Extra Variables
Date Posted: Friday, May 2, 2003 8:23:16 PM Replies: 0
   
Enclosures: None.

On 5/2/2003, Philippe Martin said:

>Nice catch, Seth!

Thank you.

>There's another good reason for using "one time" variables:
>readability. Using always the most efficient way tends to make
>the code less readable, and that's the reason why sometimes I
>choose to use a variable with a descriptive name rather than just
>a long suite of embedded calls.

That's certainly true, especially the first time you're writing a certain script.

However, once the script is working correctly and has had a bit of burn-in time, you should go back and optimize it. That's why I refer to this process as "optimization". We're not writing optimized code, we're rewriting our code to be more optimized.

Yes, replacing clearly-named locals with calls to other scripts CAN make your code less readable (unless your procedures are well named, also). However, when you're trying to optimize your script you can make up for this problem with some extra comments.

Again, this is when you're working on a script for the sole purpose of making it run faster or use less memory. Optimizing.

>Another thing I thought you'd mention as very inefficient, is
>declaring variables inside loops instead of outside (which
>unfortunately is pretty common in Frontier).

I had planned to include that, but I forgot while I was writing. Unfortunately I was in a rush... I'll probably go back and edit it later to include this additional info (just as the "Activating URL's with Regex" article has changed numerous times since I first wrote it).

Thanks for the comments, Flip!

Seth


Discussion Thread:

There are no replies.

Trackbacks:

There are no trackbacks.


Until August 31
My Amazon sales
benefit the PMC

Homepage Links

Apr 1 - Aug 31
Ad revenue
benefits the PMC


TruerWords
is Seth Dillingham's
personal web site.
From now on, ending a sentence with a preposition is something up with which I will not put. - WC