perf: RBAC role building and Enforcer optimizations#178
Conversation
perf: Enforcer hold a scope pointer rather than initalize scope when enforce. Signed-off-by: stonex <1479765922@qq.com>
Signed-off-by: stonex <1479765922@qq.com>
|
@EmperorYP7 @divy9881 @noob20000405 please review |
EmperorYP7
left a comment
There was a problem hiding this comment.
The only bottleneck we're left with is duktape itself. We may look into faster alternatives or a different approach altogether.
| } | ||
|
|
||
| void CleanScope(Scope scope) { | ||
| std::vector<std::string> props = {"obj", "sub", "act"}; |
There was a problem hiding this comment.
The props depend on config. It should be dynamic.
There was a problem hiding this comment.
Thanks for your review. I move clean_scope as a private member function in enforecer, because it based on model's config. And I exposed DeletePropFromObject for Enforcer to edit object in duktape. In this way, the clean step will be dynamic.
|
|
||
| void CleanScope(Scope scope) { | ||
| std::vector<std::string> props = {"obj", "sub", "act"}; | ||
| std::vector<std::string> objects = {"r", "p"}; |
There was a problem hiding this comment.
Again, multiple definitions can be accommodated in a single config. eg: r1, r2, r3, p1, p2, p3 etc.
AddNamedGroupingPolicy build role link by add role, Enforcer hold a scope pointer rather than initalize scope when enforce.Enforcer optimizations
Signed-off-by: stonex <1479765922@qq.com>
|
🎉 This PR is included in version 1.44.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Have done. |
I have searched lightweight |
That is not correct. What you call an "accessor" is merely adding a variable to the symbol_table by its given instance name. For example if you have a struct called my data: then subsequently have an instance of my_data and use it in an expression like so: |
Oh, thanks for your reply. I don't know this trick usage of Exprtk. I'll try to use it as the evalutor of casbin-cpp. Thanks for your reply and your great code. |
|
@ArashPartow the original author of |
|
@sheny1xuan More information and examples can be found here: |
Signed-off-by: stonex 1479765922@qq.com
Fixes #177
Description
AddNamedGroupingPolicybuild role link by add role.Screenshots/Testimonials
Enforceperformance is almost determined byduktape.benchmarkin my machine is below. Compared to before, it can improve approximately1/3. Compared to before,RBACmodel' performance problem maybe can't be solved by this pr. And I will do more profiling aboutRBACmodel.