I feel proud!
(12:21:33 IST) Jacob @ GC: thanks chetan
(12:21:42 IST) Jacob @ GC: we’ll be in touch then sometime next week
(12:21:49 IST) Chetan@globalcoding: sure ![]()
(12:21:51 IST) Jacob @ GC: check out EDU and makes sure everything is running
(12:21:57 IST) Chetan@globalcoding: will do that
(12:21:57 IST) Jacob @ GC: i really appreciate all you have done
(12:22:11 IST) Jacob @ GC: and i hope to always have you work for me! ![]()
(12:22:24 IST) Chetan@globalcoding: ![]()
(12:22:44 IST) Chetan@globalcoding: thanks and it was always nice working and interacting with you ![]()
(12:23:36 IST) Jacob @ GC: you are a great worker and i’ve been honored to work with you
(12:23:53 IST) Jacob @ GC: please let me always work with you …even if on a small level
Jacob is one of our client. ![]()
realisation
16th June, 2008, 01:19 hours, I have just realized that I will be 30 years old in coming 6 months…
![]()
…and I still haven’t…
Thanks to…
Ten commandments for code optimization (alpha release :P)
I have been reading, studying, googling about code and SQL optimisation. There are books on this subject. Following is the crux of everything. I will try to compile a list of tips for PHP, JavaScript, Apache and SQL optimisation too, hence the beta status.
The following list is applicable to any (God Damn) Computer language.
I. Thy shall never calculate or evaluate an expression at every iteration.
Following is a sin
for(i=0;i<sizeof(thelengthyarray);i++{
//do some thing
}
The same applies to SQL too. If you just need id and name from a user table don’t use SELECT * in fact use SELECT id, name FROM users. And this is not all, performing calculations on column name too slow downs the query. Avoid this too.
II. Thy shall avoid initialise and then assign. Directly assign. Save call to initialisation.
III. Thy shall avoid too many elseifs, use switch. Put the most common cases first.
IV. Thy shall avoid post increments and decrements in side a loop expression.
V. Global variable is an act of adultery. In fact avoid declaring variables as much as possible and declare variables in inner loops. They will be out of scope immidiately.
VI. Thy shall make local functions static.
VII. Thy shall avoid expensive operations.
Interestingly addition is faster than multiplication. But if you need to add first 100 integers use a mathematical formula. Why? Coz’ it will be cheap.
VIII. Thy shall always cache the data required frequently.
IX. Thy shall always “kill” the unused variable, claim the memory occupied by these and return to the system.
X. Thy shall never reinvent the wheel.
Don’t write a new sqrt() function if it is already there. RTFM. Language constructs are better than your own home baked functions.


