문제

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