-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Would there be (or is there already?) any way to lazy-load the matches and frequency lists, so that memory is only used when password strengths are actually checked? derailed shows the following retained memory stats:
retained memory by gem
-----------------------------------
12628715 zxcvbn-0.1.10
729313 activerecord-7.1.4.2
683207 activesupport-7.1.4.2
617131 mittsu-050afee4cbd3
596748 opengl-bindings-1.6.14
329826 bundled_gems
297872 tzinfo-2.0.6
297532 ffi-1.17.0
288044 bindata-2.5.0
246931 activeadmin-3.2.5
...
retained memory by file
-----------------------------------
7089732 /Users/james/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/gems/zxcvbn-0.1.10/lib/zxcvbn/matching.rb
5498886 /Users/james/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/gems/zxcvbn-0.1.10/lib/zxcvbn/frequency_lists.rb
329826 /Users/james/.rbenv/versions/3.3.5/lib/ruby/3.3.0/bundled_gems.rb
As you can see, xzcvbn is the largest by far. Lazy loading would save 12MB of memory per process, which would benefit everyone! Obviously if the tables are in regular use, then keeping them loaded is the best way, but for a site with only occasional need for the strength check, there's a potential saving to be had.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels