This PR strategically replaces the use of in_array() in favour of array_key_exists() to improve performance, as noted by this benchmark run here: https://3v4l.org/K046Q/perf#output. This benchmark also illustrates that this improvement holds for PHP 8.0 as well as the various PHP 7.x releases.
Changes are primarily focused on areas where in_array() is used often, such as URL mapping and redirection, with a specific focus on improving load times and performance of the public-facing side running the primary domain.
Release notes:
Tweaked some conditional checks to code which is more performant. The logic is identical to before, just utilising a slightly different mechanism to achieve it. This change was applied to:
Detecting and executing redirects, such as those from secondary domains to the primary domain as well as login and admin pages to the admin domain.
A check for mapping admin-ajax.php and admin-post.php appropriately on the primary domain.
This PR strategically replaces the use of
in_array()
in favour ofarray_key_exists()
to improve performance, as noted by this benchmark run here: https://3v4l.org/K046Q/perf#output. This benchmark also illustrates that this improvement holds for PHP 8.0 as well as the various PHP 7.x releases.Changes are primarily focused on areas where
in_array()
is used often, such as URL mapping and redirection, with a specific focus on improving load times and performance of the public-facing side running the primary domain.Release notes:
admin-ajax.php
andadmin-post.php
appropriately on the primary domain.