in reply to Re^2: A more elegant way to filter a nested hash? Benchmarks!
in thread A more elegant way to filter a nested hash?
Ah, can't believe I missed the keys were only being deleted once!
hash_filter_delete is indeed the only function which modifies the source hash instead of constructing a new one. See this node for the inspiration.
As for the tiny payload, the data I am actually using this hash_filter function on is of similar size and depth. I could try out some larger payloads with more levels of hash nesting to see if the iterative version does any better.
Thanks,
Jim
πάντων χρημάτων μέτρον έστιν άνθρωπος.
|
---|