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

Increase Performance in unsetting rules in ACL #134

Merged
merged 1 commit into from
Feb 28, 2021

Conversation

schrankenstein
Copy link

unsetting a non-existing rule doesn't throw an error.
In our Project this change improves loading time from 55 sec to 0.5 sec
(14412 Resources, 11694 Rules)
(see zendframework#737)

unsetting a non-existing rule doesn't throw an error.
In our Project this change improves loading time from 55 sec to 0.5 sec
(14412 Resources, 11694 Rules)
@glensc
Copy link
Collaborator

glensc commented Feb 24, 2021

@schrankenstein improve PR title/body. performance fix in what component? what's the test case? what's the downside of the change? is this backward compatible change? add unit test showing compatibility?

@schrankenstein schrankenstein changed the title Performance Fix Increase Performance in unsetting rules Feb 24, 2021
@schrankenstein
Copy link
Author

@glensc The fix is to unset the rules about 100times faster than the "old" way. The PR is already merged into zf2 (zendframework/zend-permissions-acl#29) and laminas (https://github.com/laminas/laminas-permissions-acl/blob/1ad5f2c7d65b4c2a4395010c285d583f22f9c373/src/Acl.php#L404). You can test this everytime you have changes to the acl leading to a remove of all rules by calling removeResourceAll(). The unset is very slow if you unset the roles with comparing every single existing role. There is absolutely no need for this. You can directly unsetting them without the nested foreach. Our test case is a page with many resources and rules as mentioned above. We tested this on PHP >= 5.6, the travis-ci build of zf2 is passed (see https://travis-ci.org/github/zendframework/zend-permissions-acl/builds/373529251). I did my best to describe this, i hope this is a bit clearer now

@schrankenstein schrankenstein changed the title Increase Performance in unsetting rules Increase Performance in unsetting rules in ACL Feb 24, 2021
@Shardj Shardj merged commit 0762e1b into Shardj:master Feb 28, 2021
glensc pushed a commit to glensc/php-zf1s that referenced this pull request Feb 28, 2021
unsetting a non-existing rule doesn't throw an error.
In our Project this change improves loading time from 55 sec to 0.5 sec
(14412 Resources, 11694 Rules)

Refs:
- Shardj/zf1-future#134
- zendframework/zend-permissions-acl#29
- zendframework/zf1#737

Signed-off-by: Elan Ruusamäe <glen@pld-linux.org>
falkenhawk pushed a commit to zf1s/zend-acl that referenced this pull request Oct 1, 2021
unsetting a non-existing rule doesn't throw an error.
In our Project this change improves loading time from 55 sec to 0.5 sec
(14412 Resources, 11694 Rules)

Refs:
- Shardj/zf1-future#134
- zendframework/zend-permissions-acl#29
- zendframework/zf1#737

Signed-off-by: Elan Ruusamäe <glen@pld-linux.org>
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.

3 participants