I'm using require_once() method, and I need to load a lot of files, but depending by case, I load certain php file, not all at once. I'm trying to speed up my application, and I'm wondering if I can put all of them into php.ini file as auto prepend files.
Question : Does auto prepend file do the same as requre() does?I'm speaking about performances. Precisely, if I put
auto prepend file /Files/file1.php
auto prepend file /Files/file2.php
auto prepend file /Files/file3.php
auto prepend file /Files/file4.php
is it same as (time to get those files, or auto prepend files add them on start of webserver)
require /Files/file1.php
require /Files/file2.php
require /Files/file3.php
require /Files/file4.php
Thanks!!!
auto prepend file versus require() or require_once()
Moderator: General Moderators
Re: auto prepend file versus require() or require_once()
I am not sure, as I have never done this.. but performance wise there are many many more factors that would come into play before including a file would.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Re: auto prepend file versus require() or require_once()
I have one access point php file. Let's call it ap.php. There are directed all of my ajax calls.If I can have 1000 different ajax calls, you can imagine what code I have behind ap.php . I think I can speed it up, but only I'm interested to know if auto prepend file put php file into php core, or just add it when I call ap.php and waste my time ???
Re: auto prepend file versus require() or require_once()
require is faster than require_once
also, make sure you have opcode cache (APC for example)
auto-prepend-file can not be conditional as require.
the result will be as you have require() for every one of the files at beginning of every script (not only at ap.php)
Also, in order to speed up your application, measure the performance and find the bottlenecks. It's possible that this optimization which you are doing gives you few ms improvement, while single like of code consumes several seconds.
also, make sure you have opcode cache (APC for example)
auto-prepend-file can not be conditional as require.
the result will be as you have require() for every one of the files at beginning of every script (not only at ap.php)
Also, in order to speed up your application, measure the performance and find the bottlenecks. It's possible that this optimization which you are doing gives you few ms improvement, while single like of code consumes several seconds.