-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: Change current directory in public/index.php only if necessary #7559
Conversation
Thank you for sending this PR. First of all, you must sign all your commits. |
Can you show the benchmarks? |
Running on Windows 11 with XAMPP chdir(FCPATH); if (getcwd() . DIRECTORY_SEPARATOR !== FCPATH) {} Assuming the default case is: the workdir is already correct and does not have to be changed |
Done |
|
Thanks. But see https://github.com/codeigniter4/CodeIgniter4/pull/7559/commits And we don't use If you set up git to sign automatically, |
See https://github.com/codeigniter4/CodeIgniter4/pull/7559/commits As I said, we do not use |
Thanks! Sorry, signing and rebase was completely new to me... I think I got it right now. |
On macOS.
$s = microtime(true);
for ($i = 0; $i <100000; $i++) {
// Ensure the current directory is pointing to the front controller's directory
if (getcwd() . DIRECTORY_SEPARATOR !== FCPATH) {
chdir(FCPATH);
}
}
echo microtime(true) - $s;
exit; |
@BennyBPB Thank you for rebasing! There are three commits but it seems okay with one commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the license comment.
Done, file comment is removed. |
Removing the file comment was commit no 4. |
@BennyBPB Thank you for squishing! |
Description
Checked if current directory is pointing to the front controller's directory.
Only change the directory if they differ because chdir call is not necessary and is not performant.
Checklist: