Вопрос

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?

Это было полезно?

Решение

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top