casbin / jcasbin

An authorization library that supports access control models like ACL, RBAC, ABAC in Java
https://casbin.org
Apache License 2.0
2.4k stars 464 forks source link

fix: optimize enforce method by moving common code before 'for' loop #341

Closed kdebski85 closed 1 year ago

kdebski85 commented 1 year ago

Fix: https://github.com/casbin/jcasbin/issues/336

Optimize enforce method by moving common code before 'for' loop. BenchmarkABACModel shows about 7 per cent decrease of average operation time. Make InternalEnforcerWithDispatcherTest.java compile under Java 17.

casbin-bot commented 1 year ago

@tangyang9464 @imp2002 please review

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

codecov-commenter commented 1 year ago

Codecov Report

Merging #341 (006645f) into master (5cb8846) will increase coverage by 0.28%. The diff coverage is 86.36%.

@@            Coverage Diff             @@
##           master     #341      +/-   ##
==========================================
+ Coverage   69.04%   69.33%   +0.28%     
==========================================
  Files          48       48              
  Lines        2213     2214       +1     
  Branches      409      409              
==========================================
+ Hits         1528     1535       +7     
+ Misses        566      561       -5     
+ Partials      119      118       -1     
Impacted Files Coverage Δ
...ain/java/org/casbin/jcasbin/main/CoreEnforcer.java 76.92% <86.36%> (+0.08%) :arrow_up:

... and 1 file with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

hsluoyz commented 1 year ago

@aryalrabin @PokIsemaine plz review

github-actions[bot] commented 1 year ago

:tada: This PR is included in version 1.32.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket: