Remature optimization #1773

Merged
merged 1 commit into from Dec 25, 2012

Projects

None yet

2 participants

@ghost

ksort redone so as not to replace array with boolean

@ghost Unknown referenced this pull request Dec 23, 2012
Merged

Small array merging optimization #1742

@ghost

Retesting with xhprof shows ksort still provides a performance gain, but the gain is much more minimal for a stock cms install in blog view.
Inclusive Wall Time goes from 28,542 microseconds to 25,646 before and after including this change
Inclusive CPU Time goes from 28,997 microseconds to 24,995

Or in terms I can understand, it saves 3 milliseconds of page generation/load for a moderate number of language files

Not worth the time to dig into for the speed bonus - but worth implementing once you know about it. And for me, very worth the time in learning how to use xhprof with simple, concrete, real life examples. Not worth the time digging further into JLanguage to try to speed it up any further - on the same run JDatabase eats up over 400 milliseconds - just enabling MySQL query cache would provide ten times the benefit this "fix" does. :-)

@pasamio pasamio commented on an outdated diff Dec 23, 2012
libraries/joomla/language/language.php
@@ -775,6 +779,8 @@ protected function loadLanguage($filename, $extension = 'unknown')
if (is_array($strings) && count($strings))
{
$this->strings = array_merge($this->strings, $this->override);
+ //Sort the underlying heap by key values to optimize future merges
@pasamio
pasamio Dec 23, 2012

This will probably cause a check style problem just looking at it.

@pasamio

Six commits for six changes in the same file is a bit much, do you mind rebasing?

@ghost

I'll give it a shot later at my coding system. I was having some trouble getting a clean checkout of staging.

@ghost

Cool - had to use --force on the push to get it to apply - looks much better

@ianmacl ianmacl merged commit 4b6b8e8 into joomla:staging Dec 25, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment