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

only parse info.xml once #30188

Merged
merged 1 commit into from
Feb 13, 2019
Merged

only parse info.xml once #30188

merged 1 commit into from
Feb 13, 2019

Conversation

butonic
Copy link
Member

@butonic butonic commented Jan 19, 2018

I was profiling the preview stuff and noticed that we are parsing all info.xml files twice per request.

status phppng

Top left: current state
Top rigth: cache in local variable per request for file as well.
Bottom left: This PR, cold cache
Bottom right: cached info.xml

x6 speed increase

Related: #30190

@codecov
Copy link

codecov bot commented Jan 19, 2018

Codecov Report

Merging #30188 into master will increase coverage by 0.02%.
The diff coverage is 91.13%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #30188      +/-   ##
============================================
+ Coverage     64.81%   64.83%   +0.02%     
+ Complexity    18378    18319      -59     
============================================
  Files          1199     1198       -1     
  Lines         69583    69558      -25     
  Branches       1282     1282              
============================================
- Hits          45099    45098       -1     
+ Misses        24111    24087      -24     
  Partials        373      373
Flag Coverage Δ Complexity Δ
#javascript 53.08% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit 66.19% <91.13%> (+0.02%) 18319 <3> (-59) ⬇️
Impacted Files Coverage Δ Complexity Δ
lib/private/Repair.php 26.19% <ø> (+0.3%) 21 <0> (ø) ⬇️
lib/private/App/CodeChecker/InfoChecker.php 94.44% <ø> (ø) 18 <0> (ø) ⬇️
lib/private/Installer.php 48.18% <20%> (-0.95%) 83 <0> (-4)
lib/private/legacy/app.php 63.8% <84.61%> (-0.75%) 163 <0> (-17)
lib/private/App/AppManager.php 90.76% <98.36%> (+4.91%) 52 <3> (-31) ⬇️
apps/files_trashbin/lib/Expiration.php 96.55% <0%> (-1.73%) 29% <0%> (ø)
...eratedfilesharing/lib/Controller/OcmController.php 66.06% <0%> (-0.21%) 30% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1fe1e27...2f5212d. Read the comment docs.

@butonic butonic force-pushed the only-parse-info.xml-once branch from b064dad to 88f431a Compare January 19, 2018 15:55
@butonic butonic force-pushed the only-parse-info.xml-once branch 4 times, most recently from fa4b82e to a0c381d Compare January 19, 2018 21:22
@butonic butonic requested a review from VicDeo January 19, 2018 21:34
@butonic butonic changed the title [WIP] only parse info.xml once only parse info.xml once Jan 19, 2018
@butonic butonic force-pushed the only-parse-info.xml-once branch 3 times, most recently from 8c7a171 to c6af155 Compare January 22, 2018 09:36
@mrow4a
Copy link
Contributor

mrow4a commented Jan 23, 2018

:O interesting, 👍 for idea, let's see when you finish the PR

@cdamken
Copy link
Contributor

cdamken commented Jan 23, 2018

Testing it and runs fine and faster than b4

@butonic
Copy link
Member Author

butonic commented Jan 23, 2018

yay, finally found the problem, now really ready to review

@mrow4a
Copy link
Contributor

mrow4a commented Jan 24, 2018

I remember @DeepDiver1975 telling me never to add lines in legacy and move the code to new code base. So you think this extra effort is possible here ?

Copy link
Contributor

@mrow4a mrow4a left a comment

Choose a reason for hiding this comment

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

I added few comments to better understand this part of code

if ($path) {
public static function getAppInfo($appId, $isPath = false) {
if(empty($appId)) {
return null; // TODO explode?
Copy link
Contributor

Choose a reason for hiding this comment

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

TO-DO?

Copy link
Member Author

Choose a reason for hiding this comment

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

#30190 - invalid xml produces a version of 0 ... causing migrations to not be applied
#30204 - but it needs a more in depth effort to make it explode properly / do the right thing if it explodes

Copy link
Contributor

Choose a reason for hiding this comment

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

So TODO needs to stay there?

Copy link
Member Author

Choose a reason for hiding this comment

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

as a reminder, for anyone looking at the code, yes

@butonic
Copy link
Member Author

butonic commented Jan 24, 2018

Let me see if I can move this to AppManager

@patrickjahns
Copy link
Contributor

Some more thoughts on this:

  • What happens when we upgrade an app via occ ?
  • What happenes when we upgrade/install an app via occ market:install ?

@butonic
Copy link
Member Author

butonic commented Nov 27, 2018

@patrickjahns the cache is invalidated if an info.xml etag changes. see https://github.com/owncloud/core/pull/30188/files#diff-8fa91b147fc76360cb3cfca41a1db57dR406

@PVince81
Copy link
Contributor

PVince81 commented Feb 8, 2019

@butonic please recheck for outstanding comments/tasks so someone else can take over.

@butonic butonic force-pushed the only-parse-info.xml-once branch from b4d37ae to 5e54ea0 Compare February 12, 2019 12:07
@butonic
Copy link
Member Author

butonic commented Feb 12, 2019

@PVince81 I rebased. All comments should be addressed. Please take over. Fingers crossed about the testsuite.

@PVince81 PVince81 assigned VicDeo and unassigned butonic Feb 12, 2019
@PVince81
Copy link
Contributor

@VicDeo please takeover as you're already familiar with the matter

$appInfo = \OC_App::getAppInfo($appId);
if ($appInfo === null) {
return null;
if (empty($appId)) {
Copy link
Member

@VicDeo VicDeo Feb 12, 2019

Choose a reason for hiding this comment

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

empty is not good for strings

Copy link
Member Author

@butonic butonic Feb 12, 2019

Choose a reason for hiding this comment

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

well ... ok ... i did not want to check for null, false and emptystring ... and an app id with 0 or an empty array is wrong as well .. so i think this kind of makes sense here ... maybe do if (!is_string($appId) || $appId === '')?

Copy link
Member

Choose a reason for hiding this comment

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

one of rare cases when strict comparison sucks :)

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, I went with (!is_string($appId) || $appId === '')

@VicDeo
Copy link
Member

VicDeo commented Feb 12, 2019

Great job in general, just two minor things

@butonic butonic force-pushed the only-parse-info.xml-once branch 2 times, most recently from 024caa0 to 678f54d Compare February 12, 2019 21:18
@butonic
Copy link
Member Author

butonic commented Feb 12, 2019

@VicDeo both resolved

@VicDeo VicDeo force-pushed the only-parse-info.xml-once branch from 678f54d to d3fe459 Compare February 13, 2019 08:42
@VicDeo VicDeo force-pushed the only-parse-info.xml-once branch from d3fe459 to 2f5212d Compare February 13, 2019 08:55
Copy link
Member

@VicDeo VicDeo left a comment

Choose a reason for hiding this comment

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

changed is_string to \is_string to pass CI. The rest is good.

@VicDeo VicDeo merged commit d7a09c4 into master Feb 13, 2019
@delete-merged-branch delete-merged-branch bot deleted the only-parse-info.xml-once branch February 13, 2019 09:37
@VicDeo
Copy link
Member

VicDeo commented Feb 13, 2019

@PVince81 backport?

@VicDeo
Copy link
Member

VicDeo commented Feb 14, 2019

Stable10: #34482

@lock lock bot locked as resolved and limited conversation to collaborators Feb 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants