Helper.LoadPolicyLine causes poor performance
See original GitHub issueI’m loading nearly 10000 policies in my project . the Casbin core module and Adapter is injected as Scoped service. I found this method checking policy uniqueness every time when data line loaded. I wrote a method
private void PolicyUniquenization(Model model)
{
var m = model.Model;
foreach(var key in m.Keys)
{
foreach (var ast in m[key].Values)
{
ast.Policy = ast.Policy.Distinct().ToList();
}
}
}
then alter Helper.LoadPolicyLine
method without checking data uniqueness.
and invoke at the end of LoadPolicy method in Adapter
public void LoadPolicy(Model.Model model)
{
// some codes of polices loading...
PolicyUniquenization(model);
}
seems to make things better? want to know if this modification causes any problem…
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Download Diff File
Parameters can be of any type, but will not cause errors unless actually used ... -For a very rough idea of performance, here...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
They are
Inherited from Object
, So theEquals
is equivalent to calling theReferenceEquals
method, I think we need to ensure the content is equal. And I think we can create a benchmark project which uses BenchmarkDotNet.https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1?view=netcore-3.1
List<string>
already implementedGetHashCode
andEquals