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

Add benchmarks for GlobalRoles and FolderRoles #13

Merged
merged 2 commits into from
Jul 23, 2019

Conversation

AbhyudayaSharma
Copy link
Member

Adds a benchmark to compare the performance of hasPermission() checks for global roles with those from the Role Strategy Plugin.

The benchmark emulates https://github.com/jenkinsci/role-strategy-plugin/blob/master/src/test/java/jmh/benchmarks/RoleMapBenchmark.java

@AbhyudayaSharma AbhyudayaSharma requested a review from a team July 22, 2019 09:58
@AbhyudayaSharma AbhyudayaSharma self-assigned this Jul 22, 2019
@AbhyudayaSharma
Copy link
Member Author

For 500 global Roles, the average time for one hasPermission() is 0.130 microseconds (on my machine). The latest build of Role Strategy Plugin has an average of 121.4 microseconds for one hasPermission() call:

            "scorePercentiles" : {
                "0.0" : 120.53523934042522,
                "50.0" : 121.5185190145392,
                "90.0" : 122.6657498752239,
                "95.0" : 122.7264551434821,
                "99.0" : 122.7264551434821,
                "99.9" : 122.7264551434821,
                "99.99" : 122.7264551434821,
                "99.999" : 122.7264551434821,
                "99.9999" : 122.7264551434821,
                "100.0" : 122.7264551434821
            },
            "scoreUnit" : "us/op",

@AbhyudayaSharma
Copy link
Member Author

AbhyudayaSharma commented Jul 22, 2019

The pull request build verifies the observations on my machine:

            "scorePercentiles" : {
                "0.0" : 0.157471799470619,
                "50.0" : 0.1620496203417448,
                "90.0" : 0.1688005135869144,
                "95.0" : 0.16915351346210927,
                "99.0" : 0.16915351346210927,
                "99.9" : 0.16915351346210927,
                "99.99" : 0.16915351346210927,
                "99.999" : 0.16915351346210927,
                "99.9999" : 0.16915351346210927,
                "100.0" : 0.16915351346210927
            },
            "scoreUnit" : "us/op",

Therefore this implementation is 933.84 x faster for 500 roles (would be even faster for a larger number of global roles) than the global roles in Role Strategy plugin🎉

@AbhyudayaSharma AbhyudayaSharma changed the title Add a benchmark for GlobalRole's hasPermission() Add benchmarks for GlobalRoles and FolderRoles Jul 22, 2019
@AbhyudayaSharma AbhyudayaSharma changed the title Add benchmarks for GlobalRoles and FolderRoles Add benchmarks for GlobalRoles and FolderRoles Jul 22, 2019
@AbhyudayaSharma
Copy link
Member Author

The added benchmark for Folder Roles follows from the configuration @Straber gave us and which was implemented for https://github.com/jenkinsci/role-strategy-plugin/blob/master/src/test/java/jmh/benchmarks/FolderAccessBenchmark.java . Benchmarks on Role Strategy c2bef11 takes an average time of ~77 us. On my machine, the task completes in 4.3 us. So the folder roles are faster too...

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

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

👍

@AbhyudayaSharma
Copy link
Member Author

AbhyudayaSharma commented Jul 23, 2019

Attaching results for future reference because the artifacts may be discarded by the Jenkins CI

@oleg-nenashev
Copy link
Member

🚢 🇮🇹 ? :)

@AbhyudayaSharma AbhyudayaSharma merged commit eb9ff1d into jenkinsci:master Jul 23, 2019
@AbhyudayaSharma AbhyudayaSharma deleted the benchmarks branch July 23, 2019 05:47
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.

2 participants