I want to understand how expensive is to create a new Hashie::Mash. Does calling Hashie::Mash.new(object_hash) creates a deep copy of the "object_hash"
Example: What is the time complexity of below given array size is M and emp object has N key value pair.
array.map { |emp| Hashie::Mash.new(emp)
Will it be O ( M x N ) ?
Note: I am trying to understand this from the performance perspective and N can be large won't be constant because of the nested hash. In case you want to look at the structure of emp ( employee which can have nested employees is)
{
"id"=> 1,
.
.
"nested_employee" => [
{
"id"=> 12,
.
.
},
{
"id"=> 13,
.
.
}]
.
.
}
Aucun commentaire:
Enregistrer un commentaire