Performance on the web is straightforward: a relatively small amount of servers must be able to support a potentially unlimited number of clients. Any code running on the server must be clean and fast.
When inspecting code for performance issues, I look at two things: 1) database queries, and 2) disk reads. Database queries are a critical part of most applications. Optimizing databases is a topic unto itself and I can't possibly cover it here, but I can give some coding tips in order to ease database optimization.
• Number your queries in your code. This will help you keep track of how many queries are involved in a certain process, and will save you time when trying to optimize your scripts.
• Create proper indexes. Optimized indexes are key to database speed. Any fields which are routinely queried against should have indexes. Don't create too many indexes, as unnecessary indexes will slow INSERTs and increase the database size unnecessarily.
• Test, test, and test again. Poorly written queries can kill a database server. Take the time to gauge the performance of your queries and understand what the database needs to do in order to execute them.
After database queries, disk reads are your next largest performance worry. It is common in scripted languages (like PHP or Perl) to keep groups of functions and variables in separate files in order to ease maintenance and make code more readable. While doing so has it advantages, we have to remember that every include() or require() statement involves a disk read, and every disk read increases load on the web server.
Basically, we want to design our applications to have a minimal number of included files, or perhaps include the code explicitly when our application has become relatively stable.