On Thu, 2005-08-25 at 17:46 +1000, Badai Aqrandista wrote:
> To reduce memory consumption -> look for ways to do more things on compile 
> time

Also avoid loading large things into memory all at once (e.g. slurping
files), pass references instead of copies, use the disk more, etc. 

> To reduce CPU usage -> write the most called subroutine in C

More likely would be to look at the approach you used in the slow code
(which you find with profiling) and see if you can change the algorithm
to something that does less work.  That usually gives the largest gains.
Sometimes you may be using a CPAN module (LWP, Cache::Cache) which has a
faster alternative.  Sometimes caching objects (DBI statement handles
for example) helps.

> To reduce database contention -> cache as much as possible

That can help with slow read-only queries.  For actual contention (which
implies writes and locks) you usually need to either change your access
patterns or use a different database (InnoDB tables in MySQL, Postgres,
etc.)

- Perrin

Reply via email to