File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change 11PyCasbin
22====
33
4- [ ![ GitHub Action ] ( https://github.com/casbin/pycasbin/workflows/build/badge.svg?branch=master )] ( https://github.com/casbin/pycasbin/actions )
4+ [ ![ build ] ( https://github.com/casbin/pycasbin/actions/ workflows/build.yml /badge.svg )] ( https://github.com/casbin/pycasbin/actions/workflows/build.yml )
55[ ![ Coverage Status] ( https://coveralls.io/repos/github/casbin/pycasbin/badge.svg )] ( https://coveralls.io/github/casbin/pycasbin )
66[ ![ Version] ( https://img.shields.io/pypi/v/pycasbin.svg )] ( https://pypi.org/project/pycasbin/ )
77[ ![ PyPI - Wheel] ( https://img.shields.io/pypi/wheel/pycasbin.svg )] ( https://pypi.org/project/pycasbin/ )
88[ ![ Pyversions] ( https://img.shields.io/pypi/pyversions/pycasbin.svg )] ( https://pypi.org/project/pycasbin/ )
9- [ ![ Download] ( https://img.shields.io/pypi/dm/ pycasbin.svg )] ( https://pypi.org/project/pycasbin/ )
9+ [ ![ Download] ( https://static.pepy.tech/badge/ pycasbin )] ( https://pypi.org/project/pycasbin/ )
1010[ ![ Discord] ( https://img.shields.io/discord/1022748306096537660?logo=discord&label=discord&color=5865F2 )] ( https://discord.gg/S5UjpzGZjN )
1111
1212<p align =" center " >
Original file line number Diff line number Diff line change @@ -46,13 +46,19 @@ def test_performance(self) -> None:
4646 get_examples ("performance/rbac_with_pattern_large_scale_policy.csv" ),
4747 [2 , 1 ],
4848 )
49- s_e1 = time .perf_counter ()
50- e1 .enforce ("alice" , "data1" , "read" )
51- t_e1 = time .perf_counter () - s_e1
52- s_e2 = time .perf_counter ()
53- e2 .enforce ("alice" , "data1" , "read" )
54- t_e2 = time .perf_counter () - s_e2
55- assert t_e1 > t_e2 * 5
49+ N = 5
50+ t_e1_list = []
51+ t_e2_list = []
52+ for _ in range (N ):
53+ s_e1 = time .perf_counter ()
54+ e1 .enforce ("alice" , "data1" , "read" )
55+ t_e1_list .append (time .perf_counter () - s_e1 )
56+ s_e2 = time .perf_counter ()
57+ e2 .enforce ("alice" , "data1" , "read" )
58+ t_e2_list .append (time .perf_counter () - s_e2 )
59+ avg_t_e1 = sum (t_e1_list ) / N
60+ avg_t_e2 = sum (t_e2_list ) / N
61+ assert avg_t_e1 > avg_t_e2 * 5
5662
5763 def test_creates_proper_policy (self ) -> None :
5864 e = self .get_enforcer (
You can’t perform that action at this time.
0 commit comments