On Thu, Aug 13, 2009 at 5:06 PM, bala chandar <[email protected]>wrote:
> I dont want to exactly optimize the code.I just want to
> highlight the piece of code where the programmer can optimize.I
> studied a module in Infosys campus connect program about "algorithm
> design" and there they listed a series of techniques to follow when
> coding (Like the one below).
>
> Just like this,
> for( i = 0 ; i < ( j/ 100) ; i++)
> {
> //bla bla
> }
> If i execute this each time ( j/100 ) is calculated and takes
> more amount of time.
> Instead of this,If i follow this,
> k = j /100;
> for( i = 0 ; i < k ; i++)
> {
> //bla bla
> }
>
The C/C++ compiler (gcc) is advanced enough to mostly take care of these
kind of _optimizations_. In fact, most of the languages support these kind
of loop unrolling, constant propagation etc.
For a better understanding , check this out :
http://www.nullstone.com/htmls/category.htm
The Infy guys(if i may safely assume) are just trying to make you understand
the importance of coding in an _efficient_ way.
> I hope for my idea i dont need to learn all these
> things.If i need to do then i m ready to learn.(not years but months
> ;-))
You can rather shout : "i want to be spoonfed" :P. But on a serious note,
the topic under contention is _one_ of the most challenging topics and
requires prudence.
If you just want a dictionary of such changes (as you have mentioned above),
then write a few regular expressions and search/replace it; but i dont think
anyone sane would use it; BUT it might teach you some regular expressions,
which you can learn in a month(or a week, if you are smart).
-V-
_______________________________________________
To unsubscribe, email [email protected] with
"unsubscribe <password> <address>"
in the subject or body of the message.
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc