Skip to content
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

Improve performance of HTMLHelepr include relative paths #134

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from

Conversation

andrepereiradasilva
Copy link
Owner

Summary of Changes

Improve performance of include relartive path when php configuration uses open_basedir

Testing Instructions

  1. Test performance, use open_basedir in your php config and put, for instance (try with other files, paths and parameters), in your template index.php.
use Joomla\CMS\HTML\HTMLHelper;

$timeStart = microtime(true);
HTMLHelper::_('image' , 'calendar.png', 'alternative text');
HTMLHelper::_('image' , 'joomla.png', 'alternative text');
HTMLHelper::_('image' , 'system/pdf_button.png', 'alternative text');
HTMLHelper::_('image' , 'media/uploading.png', 'alternative text');
HTMLHelper::_('image' , 'jui/ajax-loader.gif', 'alternative text');
HTMLHelper::_('image' , 'mod_languages/uk_ua.gif', 'alternative text');
HTMLHelper::_('script' , 'caption.js');
HTMLHelper::_('script' , 'system/validate.js');
HTMLHelper::_('script' , 'jui/jquery.min.js');
HTMLHelper::_('script' , 'plg_system_stats/stats.js');
HTMLHelper::_('script' , 'mod_sampledata/sampledata-process.js');
HTMLHelper::_('stylesheet' , 'template.css');
HTMLHelper::_('stylesheet' , 'system/frontediting.css');
HTMLHelper::_('stylesheet' , 'jui/bootstrap.min.css');
HTMLHelper::_('stylesheet' , 'plg_system_highlight/highlight.css');
HTMLHelper::_('stylesheet' , 'mod_languages/template.css');
echo number_format(((microtime(true) - $timeStart) * 1000), 3) . 'ms';

My results in php 7.1.x with open_basedir:

  • Before: ~3.400ms
  • After: ~1.500ms

More files loaded more savings.

  1. Test if all the css, scripts and images still render fine.

  2. Code review.

Documentation Changes Required

None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant