Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use match? in FactoryBot#aliases_for to save allocations (#1457)
FactoryBot relies on ruby >= 2.5, so we can use Regexp#match? that does not allocate MatchData Allocations measured with heap-profiler gem in an internal test suite with 7497 examples and 149470 calls to aliases_for: allocated memory by file ----------------------------------- 59.79 MB factory_bot-6.1.0/lib/factory_bot/aliases.rb 38.27 MB factory_bot-6.1.0/lib/factory_bot/aliases.rb allocated objects by file ----------------------------------- 896880 factory_bot-6.1.0/lib/factory_bot/aliases.rb 597940 factory_bot-6.1.0/lib/factory_bot/aliases.rb
- Loading branch information