2. Four rules of code efficiency
â
â
First, do no harm
You don't know what the problem is until
you measure it
â
Whats under your control
â
Always look for the easy win
4. MEMORY
â
Make efficient use of system memory
â
Prevent large swapping files
â
Memory is cheap, users are not
â
Prevent memory leaks
â
Measure memory usage of your
applications
5. DISK I/O
â
â
â
â
Make efficient usage of disk storage
Make usage of faster storage mechanisms
such as ssd, net storage
Monitor your apps disk i/o and ways to
optimize it
You can reduce disk i/o to make your apps
more faster
6. Network I/O
â
â
â
Make lesser number of network calls
Compress the network calls in formats
such as gzip
Reduce comments, blank spaces, optimize
resources on network
â
More network I/O means more cost
â
Monitor your apps network I/O
â
Cache similar network i/o requests
7. Algorithmic Efficiency
â
â
â
â
Use languages inbuilt functions for doing
complex tasks rather than building your
own from scratch, eg: sorting
Make efficient use of data types, data
structures, memory allocation
Make efficient use of loops & recursion
Take a sample code and think how can you
make it more efficient without having any
effect on its output
8. PRECAUTION
â
â
Making changes for efficiency which has
no noticable efficieny gains on user
experience on user expericnce is bullshit.
You are trying to make button click faster,
without noticing this thing has no effect on
user experience.