Optimize CSV to share hash key objects between rows
Currently, when CSV headers are strings, then each row receives a copy of the strings for hash keys. This patch is an optimization to share the same frozen string keys between all rows.
Please verify: in the implementation of
Hash::, are strings the only object that is dup'd, or should other types be frozen so they aren't copied for each row too?
#3 [ruby-core:58541] Updated by avit (Andrew Vit) about 4 years ago
Thanks nobu, I write too much RSpec lately.
Updated patch attached: I also added freeze in Row#initialize, not sure if both places are needed, or which is better. Please review.