Hello!
In a simple profile calling enforce a few times,looping over ~500 policies, I have noticed that I spend almost 10% of my time in casbin.util.has_eval.
I believe it could be avoided if we reused the has_eval variable computed out of the loop (line 369). It could also probably be cached in the Assertion object stored in self.model["m"][mtype]
https://github.com/casbin/pycasbin/blob/a16bfaa669c37ac1598684e36b0319430ab749e5/casbin/core_enforcer.py#L369
has_eval = util.has_eval(exp_string)
https://github.com/casbin/pycasbin/blob/a16bfaa669c37ac1598684e36b0319430ab749e5/casbin/core_enforcer.py#L388
Let me know if you would like a PR
Hello!
In a simple profile calling enforce a few times,looping over ~500 policies, I have noticed that I spend almost 10% of my time in casbin.util.has_eval.
I believe it could be avoided if we reused the
has_evalvariable computed out of the loop (line 369). It could also probably be cached in the Assertion object stored inself.model["m"][mtype]https://github.com/casbin/pycasbin/blob/a16bfaa669c37ac1598684e36b0319430ab749e5/casbin/core_enforcer.py#L369
has_eval = util.has_eval(exp_string)
https://github.com/casbin/pycasbin/blob/a16bfaa669c37ac1598684e36b0319430ab749e5/casbin/core_enforcer.py#L388
Let me know if you would like a PR