Closed duzun closed 9 years ago
This happens because DBMatcher's are being allocated multiple times which is loading the frequency lists using lots of memory. If you put the frequency list initialization in a singleton it stops the memory leak and makes performance good again
This is not the case. DBMatcher
is alocated exactly once in [DBZxcvbn init];
Acording to my tests, most of the time is spent inside this call:
DBResult *result = [self.scorer minimumEntropyMatchSequence:password matches:matches];
In the spacialEntropy call in DBScorer the allocate method is called again. I believe this method is only called on long passwords and thats why the slowdown only happens on longer passwords
IF DBMatcher
is so slow, I think it should share the data between instances, with the posibillity to free it when needed.
Thats what I did to fix it I wrapped the initialization of the frequency lists and adjacency graphs in a singleton object so they are only ever created once and it sped up the performance significantly
@jessemx109 want to submit a pull request with that change? That would be really nice :smile:
:+1: would appreciate that performance boost
I think this was done in #8?
Closing this issue but feel free to re-open if there's more we can do to improve this.
For password
testScorePassword123
it takes 0.5 sec to compute the score, which is A LOT!It looks like there is some high complexity algorithm, cause time grows exponentially after some length.