Stut wrote: > Jochem Maas wrote: >> news_yodpeirs@xxxxxxxxxxxx wrote: >>> I got different portions of code only used for certain purposes (who >>> don't ;-)?). But what, in your opinion (better: in your experience) >>> would be the best regarding script-performance: Putting each >>> code-portion in a separate file and include it if required, putting >>> it in a constant-dependent if-structure (if (defined('FOO') && FOO) >>> {class foo{}; function foo(); ...}) >> >> defining functions or classes conditionally is not recommended, >> because it >> means they can only be defined at runtime and not compile time ... >> which will >> kill any op-code caching you might have in place or use in future >> (e.g. php.net/apc) > > I'm not completely sure, but I think you're wrong there. Removing the > condition in the example above will not affect any opcode caching since > PHP cannot determine the result of that conditional until runtime. one of us is reading the other's post incorrectly - I have a feeling we are both trying to say the same thing. namely runtime class definitions don't have the same benefit of op-code caching as compiletime definitions. or not? > > To the OP: You're treading on the dangerous ground of premature > optimisation. In the grand scheme of things the time taken for PHP to > compile your scripts is tiny compared to the time it will take to run > it. And as mentioned there are several ways to cache the compilation > output which turns that tiny time into a negligible time. > > Worry about the structure and maintainability of your app rather than > thinking about how fast it is. Once you have the app doing something > useful you can start to think about how to make it do it quickly. > > -Stut > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php