Do empty arrays in JSON hurt performance when parsing the JSON dataset?

74 Views Asked by At

I have a rather large JSON data set that I am parsing through using DoT.js to populate a template for display. I see that there are over 3400 empty arrays for a portion of the JSON that I am not even using to populate the template. Here is the piece of unused JSON.

,"COMMENTS":[]

I am parsing through it at an earlier point in my code to convert the keys to in the entire JSON data set to lowercase.

,"comments":[]

Does having a empty array like this impact performance negatively?

1

There are 1 best solutions below

0
Alytrem On BEST ANSWER

Yes, it has an impact on performances. First, data transfer will take a little longer, but also JSON parsing will be slower.

http://jsperf.com/json-empty-arrays-perf