The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Benefits from placing hook code in external files?
Is there any benefit from putting hook code in an external file?
I see some developers just put something like this in the Plugin Manager hook location: Code:
require(DIR . '/includes/some_hack/hooks/forumdisplay_complete.php'); I use xCache for caching PHP files, so I can see the benefit of those files being cached, however I see the overhead of adding another file to the page. I was wondering if there are any performance (or other) benefits to using this method as opposed to just putting the full code into the Plugin Manager. Or are there any performance drawbacks to this method? Thanks, James |
#2
|
|||
|
|||
I'm curious about that too. I don't have that level of knowledge about php, but my guess would be that if you have a cache that can cache the parsed php then it could improve the performance over having to parse the code from the database every time.
|
#3
|
||||
|
||||
The overhead of including a php file depends on the size and number of files, but for your average addon I'd say it's rather negligible.
Why do it? It is simply way more comfortable to develop addons using your favourite editor and just hit the save button over having to copy the code to the AdminCP input box every time. The main benefit regarding performance is that you have to keep less code in the datastore cache (only the include vs. all of the actual code). Overall, I'd say the tradeoff is well worth it. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|