Skip to content
This repository
Browse code

Memoize the names of attributes to assign for a 33% speed increase on…

… factories with overrides
  • Loading branch information...
commit acb263632173f2bc55eb843765cc17bea12645b7 1 parent 8209a46
Joshua Clayton authored July 25, 2012

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. 2  lib/factory_girl/attribute_assigner.rb
2  lib/factory_girl/attribute_assigner.rb
@@ -77,7 +77,7 @@ def attributes_to_set_on_hash
77 77
     end
78 78
 
79 79
     def attribute_names_to_assign
80  
-      non_ignored_attribute_names + override_names - ignored_attribute_names - alias_names_to_ignore
  80
+      @attribute_names_to_assign ||= non_ignored_attribute_names + override_names - ignored_attribute_names - alias_names_to_ignore
81 81
     end
82 82
 
83 83
     def non_ignored_attribute_names

0 notes on commit acb2636

Please sign in to comment.
Something went wrong with that request. Please try again.