Please sign in to comment.
Save typecast/uncast values and use those where possible, rather than…
… recomputing them every time they're accessed. Use #key? rather than #keys.include? for better performance Significantly reduce calls to #read_keys by avoiding #attributes calls from ActiveModel::Dirty. Improve the speed of #read_keys by avoiding string interns and ivar lookups where possible. Eliminate extraneous array creations in Keys#attributes and Associations#embedded_associations. Improve the speed of Dirty#write_key by using ivars directly rather than going through instance methods. Revert to the slower-but-more-semantic key reads for #attributes now that the Dirty attributes thrashing is fixed. attr_accessor -> attr_reader for semantic correctness
- Loading branch information...
Showing with 42 additions and 32 deletions.
- +7 −1 lib/mongo_mapper/plugins/associations.rb
- +3 −1 lib/mongo_mapper/plugins/clone.rb
- +4 −6 lib/mongo_mapper/plugins/dirty.rb
- +1 −1 lib/mongo_mapper/plugins/document.rb
- +25 −21 lib/mongo_mapper/plugins/keys.rb
- +1 −1 lib/mongo_mapper/plugins/rails.rb
- 0 test/functional/test_embedded_document.rb
- +1 −1 test/unit/test_embedded_document.rb