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

Performance optimizations #1 #12171

Merged
merged 48 commits into from
Jun 15, 2017
Merged

Performance optimizations #1 #12171

merged 48 commits into from
Jun 15, 2017

Conversation

frankmayer
Copy link
Contributor

@frankmayer frankmayer commented Sep 25, 2016

[UPDATED (5.1.2017) - see second paragraph]
Those are some performance optimizations for the libraries/cms folder. If you like those, there are plenty more where those came from.
Since I don't know if you guys are open to these kinds of PR's. I am awaiting the developments of my open PR's before I do more.

[Update 5.1.2017]
In order to lighten this PR up, I have introduced 6 sub-PRs, which are easier to digest and mostly with very specific changes. In order to continue with this one, those ones should be tested/reviewed/merged first. After that, I can resolve the conflicts and there should finally be only a few changes left.

Copy link
Contributor

@zero-24 zero-24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good from here. Thanks!

Copy link
Contributor

@zero-24 zero-24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please have a look at: https://travis-ci.org/joomla/joomla-cms/jobs/162592381 It looks like travis is not happy.

@zero-24
Copy link
Contributor

zero-24 commented Sep 25, 2016

Travis error is:

1) JComponentRouterLegacyTest::testParse
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
     'option' => 'com_test'
-    42 => 'test-test'
+    42 => 'test:test'
 )
/home/travis/build/joomla/joomla-cms/tests/unit/suites/libraries/cms/component/router/JComponentRouterLegacyTest.php:130
2) JRouterTest::testDecodeSegments with data set #3 (array('42-test', 'testing-this-method'), array('42:test', 'testing:this-method'))
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
     0 => '42:test'
-    1 => 'testing:this-method'
+    1 => 'testing:this:method'
 )
/home/travis/build/joomla/joomla-cms/tests/unit/suites/libraries/cms/router/JRouterTest.php:872

https://travis-ci.org/joomla/joomla-cms/jobs/162592381

@frankmayer
Copy link
Contributor Author

Yes, I noticed... :) Will fix errors.

@frankmayer
Copy link
Contributor Author

on it...

Copy link
Contributor

@andrepereiradasilva andrepereiradasilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some minor comments

{
if (substr($entry, 0, 1) !== '.' && is_file($dir . DIRECTORY_SEPARATOR . $entry)
if ($entry[0] !== '.' && is_file($dir . DIRECTORY_SEPARATOR . $entry)
&& strpos($entry, '.html') === false && strpos($entry, '.php') === false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO is_file should be the last check sine it makes I/O call to the filesystem.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, missed that one. Nice catch.

@@ -9,6 +9,7 @@

defined('JPATH_PLATFORM') or die;


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remvoe this extra line


if ($appProperty->isPrivate() === false && is_null($this->app))
if ($reflection->getProperty('app')->isPrivate() === false && $this->app === null)
Copy link
Contributor

@andrepereiradasilva andrepereiradasilva Jun 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change the order of the conditions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep


if ($dbProperty->isPrivate() === false && is_null($this->db))
if ($reflection->getProperty('db')->isPrivate() === false && $this->db === null)
Copy link
Contributor

@andrepereiradasilva andrepereiradasilva Jun 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change the order of the conditions?

@andrepereiradasilva
Copy link
Contributor

I have tested this item ✅ successfully on 171f66b

code review


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12171.

@peteruoi
Copy link

Just an idea...
If there is a considerable performance in joomla paging loading maybe a metric could be done with and without all these performance prs and if is enough it could be advertises in joomla 3.8 release campaign?
thanks frankmayer for your work!

@frankmayer
Copy link
Contributor Author

@peteruoi that is an interesting idea. However I assume that any improvements from all the PRs will vary a lot with mileage. Unfortunately I haven't got the time to set this up and do the tests.
Oh, and a lot of things made it already into 3.7.

Another situation where I would hope to see some measurable optimization would be, if the indexer performance PR would be merged (see #13511).
This would of course mostly be measureable with initial (or re-) indexing of a lot of index-able content.
But I also would like to think that on changing of content, it might work a little bit faster.

@@ -192,7 +192,7 @@ public static function menuItemList($name, $selected = null, $attribs = null, $c
'select.genericlist', $options, $name,
array(
'id' => isset($config['id']) ? $config['id'] : 'assetgroups_' . (++$count),
'list.attr' => (is_null($attribs) ? 'class="inputbox" size="1"' : $attribs),
'list.attr' => ($attribs === null ? 'class="inputbox" size="1"' : $attribs),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove parentheses. Should I report them here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's just the right place ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got more? Shall I wait?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also align =

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More reported and I am done for now. 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Done a few more things I found along the way.

@@ -451,7 +451,7 @@ public function getPagesLinks()
public function getPaginationLinks($layoutId = 'joomla.pagination.links', $options = array())
{
// Allow to receive a null layout
$layoutId = (null === $layoutId) ? 'joomla.pagination.links' : $layoutId;
$layoutId = ($layoutId === null) ? 'joomla.pagination.links' : $layoutId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove parentheses and more below.

@@ -127,12 +127,12 @@ public function getSha1($jsonData, JTableContenttype $typeTable)
// Go one level down for JSON column values
foreach ($value as $subName => $subValue)
{
$object->$subName = (is_int($subValue) || is_bool($subValue) || is_null($subValue)) ? (string) $subValue : $subValue;
$object->$subName = (is_int($subValue) || is_bool($subValue) || $subValue === null) ? (string) $subValue : $subValue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove parentheses

}
}
else
{
$object->$name = (is_int($value) || is_bool($value) || is_null($value)) ? (string) $value : $value;
$object->$name = (is_int($value) || is_bool($value) || $value === null) ? (string) $value : $value;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove parentheses

@frankmayer
Copy link
Contributor Author

Bump @andrepereiradasilva & @Quy Problem solved. Pls test (review changes) to go for RTC

@andrepereiradasilva
Copy link
Contributor

I have tested this item ✅ successfully on 171f66b

Code review


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12171.

@andrepereiradasilva
Copy link
Contributor

@peteruoi when we have levels like Joomla server side performance things are not like 30% Faster in all Pages. Is really relative to each change and to the amount of scenarios that change apllies to
For instance in the past made several changes that boosted performance only in multilingual sites.

Imo the most important performance improvements are the ones done to the critical page that apllies to all pages and also most used parts (com_content, jroute, etc).
That said general improvements like this set of prs also contribute as a whole.

@Quy
Copy link
Contributor

Quy commented Jun 13, 2017

I have tested this item ✅ successfully on 171f66b

Code review.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12171.

@ghost
Copy link

ghost commented Jun 14, 2017

RTC after two successful tests.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jun 14, 2017
@peteruoi
Copy link

@andrepereiradasilva Even with a 5% percent general it will be awesome news for advertisment for 3.8 campaign. And no one forbids us to say 5% to 20% (at miltilingual for example).
I think it's a pity that the optimization you awesome fellows do and make joomla and the internet faster is not recognized enough :).
This metric of course it cannot be pr dependent but before release 3.7 vs 3.8 tests and if they are favourite for us we advertise ;)

@rdeutz rdeutz merged commit bcfbfa0 into joomla:staging Jun 15, 2017
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Jun 15, 2017
@rdeutz rdeutz added this to the Joomla 3.7.3 milestone Jun 15, 2017
@frankmayer
Copy link
Contributor Author

Hooray, this really big chunk was finally merged! Thank you all for your comments and efforts in testing

@frankmayer frankmayer deleted the Performance_1 branch August 23, 2017 18:58
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.