Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-1200

attribute_changed?/clone in reader for hash-values makes application terrible slow

    • Type: Icon: Task Task
    • Resolution: Done
    • 2.2.1
    • Affects Version/s: None
    • Component/s: None
    • None

      Hi there,

      we just upgraded from 2.0 rc to current version and just realized why we had to roll back (had strange performance issues):
      We're reading from a Hash field very often and this was just dragging down our whole system.
      I traced it down to this part in fields#create_accessors:

                    read_attribute(name).tap do |value|
                      if value.is_a?(Array) || value.is_a?(Hash)
                        changed_attributes[name] = value.clone unless attribute_changed?(name)
                      end
                    end
      

      the #attribute_changed? calls aswell as the #clone call seem to slow down everything.
      I'll keep you posted with additional details.

            Assignee:
            durran Durran Jordan
            Reporter:
            tobsch Tobias Schlottke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: