vendredi 18 janvier 2019

why is memory occupied by Active record object less than the hash form of that record?

By using ObjectSpace.memsize_of() in rails, i noticed active record object occupies lesser space than hash. Ex : Say a = User.last , b = a.attribues, c = a.json .
I got ObjectSpace.memsize_of(a) < ObjectSpace.memsize_of(b) ObjectSpace.memsize_of(c). why is this and how is it possible ?

Aucun commentaire:

Enregistrer un commentaire