0

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?

JstnPwll
  • 8,585
  • 2
  • 33
  • 56
Sultan Shakir
  • 724
  • 2
  • 11
  • 22
  • have you tested it to see? – Ben McCormick Apr 05 '13 at 16:01
  • What do you understand by "performance"? Are you talking about how fast will JS parse JSON? Then yes, it will have negative impact (but it should be fast enough, though). Otherwise it will only consume more memory, no speed hit. – freakish Apr 05 '13 at 16:04

1 Answers1

1

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

Alytrem
  • 2,620
  • 1
  • 12
  • 13