Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[PropertyAccess] Remove most ref mismatches to improve perf#18224

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:2.3fromnicolas-grekas:fix-ref-mismatch
Mar 21, 2016

Conversation

@nicolas-grekas
Copy link
Member

QA
Branch?2.3
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?no
Fixed tickets-
LicenseMIT
Doc PR-

This PR is for PHP5 where ref mismatches is a perf pain: it removes all ref mismatches along the "getValue" path, and keeps only the required ones on the "setValue" path.

stloyd and Disparity reacted with thumbs up emoji
@stof
Copy link
Member

do you have a profiling comparison of the gain to know how much difference it makes ?

}elseif (is_array($zval[self::VALUE])) {
$result[self::REF] = &$zval[self::REF][$index];
}elseif (is_object($result[self::VALUE])) {
// Objects are always passed around by reference
Copy link
Member

Choose a reason for hiding this comment

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

this comment is not accurate (but we don't need a reference when dealing with objects). I suggest updating it to avoid confusing people reading the code

@nicolas-grekasnicolas-grekasforce-pushed thefix-ref-mismatch branch 4 times, most recently from2fceaef to0c8e7edCompareMarch 18, 2016 12:48
@nicolas-grekas
Copy link
MemberAuthor

Here is a first comparison:
https://blackfire.io/profiles/compare/c77e869c-a5ba-44da-8cea-8a45c3c151ab/graph
capture du 2016-03-18 15 10 41

$var =range(1,1000000);$pa =newPropertyAccessor();$res =$pa->getValue($var,'[12]');

@javiereguiluz
Copy link
Member

A more realistic benchmark would be to userange(1, 1000) or so. In any case, impressive numbers! Thanks for the optimization.

@nicolas-grekas
Copy link
MemberAuthor

And one with setValue:
https://blackfire.io/profiles/compare/15688eff-7e1b-48fb-9d97-c6f22278603c/graph
capture du 2016-03-18 15 40 35

$var =range(1,100000);$pa =newPropertyAccessor();$res =$pa->setValue($var,'[12]',$var);
webmozart reacted with hooray emoji

@stof
Copy link
Member

These numbers are very impressive.

@nicolas-grekas can you also post a benchmark for a deeper property path ?

👍
Status: reviewed

@fabpot
Copy link
Member

Thank you@nicolas-grekas.

@fabpotfabpot merged commit72940d7 intosymfony:2.3Mar 21, 2016
fabpot added a commit that referenced this pull requestMar 21, 2016
…f (nicolas-grekas)This PR was merged into the 2.3 branch.Discussion----------[PropertyAccess] Remove most ref mismatches to improve perf| Q             | A| ------------- | ---| Branch?       | 2.3| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | no| Fixed tickets | -| License       | MIT| Doc PR        | -This PR is for PHP5 where ref mismatches is a perf pain: it removes all ref mismatches along the "getValue" path, and keeps only the required ones on the "setValue" path.Commits-------72940d7 [PropertyAccess] Remove most ref mismatches to improve perf
@nicolas-grekasnicolas-grekas deleted the fix-ref-mismatch branchMarch 21, 2016 16:50
This was referencedMar 25, 2016
@webmozart
Copy link
Contributor

Awesome, thanks@nicolas-grekas :)

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@nicolas-grekas@stof@javiereguiluz@fabpot@webmozart@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp