What is the complexity of JSON.parse() in JavaScript?

前端 未结 3 1260
醉酒成梦
醉酒成梦 2021-02-08 22:55

The title says it all. I\'m going to be parsing a very large JSON string and was curious what the complexity of this built in method was.

I would hope that it\'s θ(n) w

3条回答
  •  旧时难觅i
    2021-02-08 23:04

    JSON is very simple grammar that does not require even lookaheads. As soon as GC is not involved then it is purely O(n).

提交回复
热议问题