Re: Performance Consideration of 1 class per file

From: Date: Sat, 24 Apr 2004 07:13:16 +0000
Subject: Re: Performance Consideration of 1 class per file
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-9528@lists.php.net to get a copy of this message
Rasmus Lerdorf wrote:
1. The included_files list gets updated each time you include a file. In order to make sure that the same file included by different paths or symlinks don't conflict we do a realpath() on the file to be included.
That's done by PHP, not APC, right? Does this only apply to require_once or require as well?
2. APC uses the file's device and inode as the lookup key into shared memory to find the opcodes for the file, so a stat has to be done on
Hmm.. If the stat on the file and the check for device/inode would be done first then you wouldn't have to do a realpath, right? But I guess that's not easily done until after the realpath check.
So yes, jumping from 20 to 30 include files could very well bring a rather significant performance hit.
I guess that's only important if your PHP code is really simple and you don't do something like e.g. DB queries because otherwise that'd be 90% of the running time anyway, right? I guess someone _that_ considered about performance could easily do a cat *.php | grep -v require | php -w >app.lib or the like and include app.lib. - Chris

« previous php.internals (#9528) next »