Skip to content

[Cache] Improve perf of array-based pools #27563

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

Merged
merged 1 commit into from
Jun 18, 2018

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Jun 9, 2018

Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -
  • skip key validation when key is already known
  • remove overhead in ArrayCache::get() via inlining
  • don't store simple values in serialized format when not needed, preserving COW

Needs #27565 to be green.

@nicolas-grekas
Copy link
Member Author

nicolas-grekas commented Jun 11, 2018

(failure is a false-positive.)

$value = serialize($value);
}
} elseif (null !== $value && !\is_scalar($value)) {
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't null be serialized too ?

Copy link
Member Author

Choose a reason for hiding this comment

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

correct, fixed

@stof
Copy link
Member

stof commented Jun 14, 2018

@nicolas-grekas it seems to duplicate the same logic in ArrayAdapter and ArrayCache. Should part of it be moved to the ArrayTrait to be shared ?

@nicolas-grekas nicolas-grekas force-pushed the cache-array branch 3 times, most recently from 7ce8c1d to 8bb8e83 Compare June 14, 2018 11:26
@nicolas-grekas
Copy link
Member Author

@stof done

@nicolas-grekas
Copy link
Member Author

PR ready

@fabpot
Copy link
Member

fabpot commented Jun 18, 2018

Thank you @nicolas-grekas.

@fabpot fabpot merged commit 92a2d47 into symfony:master Jun 18, 2018
fabpot added a commit that referenced this pull request Jun 18, 2018
…kas)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[Cache] Improve perf of array-based pools

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

- skip key validation when key is already known
- remove overhead in `ArrayCache::get()` via inlining
- don't store simple values in serialized format when not needed, preserving COW

~~Needs #27565 to be green.~~

Commits
-------

92a2d47 [Cache] Improve perf of array-based pools
@nicolas-grekas nicolas-grekas deleted the cache-array branch June 18, 2018 16:13
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.2 Nov 1, 2018
This was referenced Nov 3, 2018
nicolas-grekas added a commit that referenced this pull request Dec 13, 2018
This PR was merged into the 4.2 branch.

Discussion
----------

[Cache] Fix undefined variable in ArrayTrait

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

After upgrading my project to 4.2 my tests failed with a message that `$key` variable is missing here: https://github.com/symfony/symfony/blob/e81285249b780a11ed209a79fa77c1f6ea6da67b/src/Symfony/Component/Cache/Traits/ArrayTrait.php#L131 which seems to be introduced with PR #27563.

So I added that variable to the trait and method calls (are there any other?). This is internal class so I guess noone is using it anywhere.

Anyway, my tests pass with this fix.

Commits
-------

b0b5937 Fix undefined variable in cache ArrayTrait
symfony-splitter pushed a commit to symfony/cache that referenced this pull request Dec 13, 2018
This PR was merged into the 4.2 branch.

Discussion
----------

[Cache] Fix undefined variable in ArrayTrait

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

After upgrading my project to 4.2 my tests failed with a message that `$key` variable is missing here: https://github.com/symfony/symfony/blob/e81285249b780a11ed209a79fa77c1f6ea6da67b/src/Symfony/Component/Cache/Traits/ArrayTrait.php#L131 which seems to be introduced with PR symfony/symfony#27563.

So I added that variable to the trait and method calls (are there any other?). This is internal class so I guess noone is using it anywhere.

Anyway, my tests pass with this fix.

Commits
-------

b0b5937d1d Fix undefined variable in cache ArrayTrait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants