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

feat: add getRoleManager() and benchmark the role manager #287

Merged
merged 2 commits into from
Aug 17, 2022

Conversation

seriouszyx
Copy link
Member

@seriouszyx seriouszyx commented Aug 16, 2022

Signed-off-by: Yixiang Zhao seriouszyx@foxmail.com

#285 greatly optimizes the read performance.

benchmark results as below.

Previous

Benchmark                                                            Mode  Cnt         Score        Error  Units
BenchmarkRoleManager.buildRoleLinksWithDomainPatternLarge            avgt    3    388238.708 ±  74073.914  ns/op
BenchmarkRoleManager.buildRoleLinksWithPatternAndDomainPatternLarge  avgt    3    385646.841 ± 121960.052  ns/op
BenchmarkRoleManager.buildRoleLinksWithPatternLarge                  avgt    3    389432.527 ±  84891.800  ns/op
BenchmarkRoleManager.hasLinkWithDomainPatternLarge                   avgt    3     22438.181 ±   6081.470  ns/op
BenchmarkRoleManager.hasLinkWithPatternAndDomainPatternLarge         avgt    3  32539211.688 ± 726439.161  ns/op
BenchmarkRoleManager.hasLinkWithPatternLarge                         avgt    3    271573.056 ±  87480.915  ns/op
BenchmarkRoleManager.roleManagerLarge                                avgt    3    986304.711 ± 443216.069  ns/op
BenchmarkRoleManager.roleManagerMedium                               avgt    3     75812.648 ±  39482.414  ns/op
BenchmarkRoleManager.roleManagerSmall                                avgt    3      8637.022 ±   1424.933  ns/op

Current

Benchmark                                                            Mode  Cnt          Score          Error  Units
BenchmarkRoleManager.buildRoleLinksWithDomainPatternLarge            avgt    3    4647258.438 ±   427177.263  ns/op
BenchmarkRoleManager.buildRoleLinksWithPatternAndDomainPatternLarge  avgt    3  429547769.444 ± 99949898.718  ns/op
BenchmarkRoleManager.buildRoleLinksWithPatternLarge                  avgt    3  430363173.430 ± 83260148.321  ns/op
BenchmarkRoleManager.hasLinkWithDomainPatternLarge                   avgt    3        102.557 ±        1.827  ns/op
BenchmarkRoleManager.hasLinkWithPatternAndDomainPatternLarge         avgt    3        543.531 ±       29.553  ns/op
BenchmarkRoleManager.hasLinkWithPatternLarge                         avgt    3        540.807 ±        4.678  ns/op
BenchmarkRoleManager.roleManagerLarge                                avgt    3    1589462.918 ±    73110.261  ns/op
BenchmarkRoleManager.roleManagerMedium                               avgt    3     134077.173 ±    14764.067  ns/op
BenchmarkRoleManager.roleManagerSmall                                avgt    3      12922.454 ±     2646.040  ns/op

Signed-off-by: Yixiang Zhao <seriouszyx@foxmail.com>
@casbin-bot
Copy link
Member

@tangyang9464 @imp2002 please review

@tangyang9464
Copy link
Member

@seriouszyx Can you add getNamedRoleManager and setNamedRoleManager?

Signed-off-by: Yixiang Zhao <seriouszyx@foxmail.com>
@seriouszyx
Copy link
Member Author

@tangyang9464 done

Copy link
Member

@tangyang9464 tangyang9464 left a comment

Choose a reason for hiding this comment

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

lgtm

@hsluoyz hsluoyz merged commit f5e38b6 into casbin:master Aug 17, 2022
@github-actions
Copy link

🎉 This PR is included in version 1.27.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants