简体   繁体   English

PHP优化-json_decode

[英]PHP optimization - json_decode

My PHP application is decoding about 100 json objects each request, I have many requests per secound, and I need to optimize my code. 我的PHP应用程序每个请​​求解码大约100个json对象,每秒钟有很多请求,并且我需要优化代码。 I was wondering if it would be faster to decode one huge json object instead of 100 smaller ones (assuming this big json was made by nesting the small ones). 我想知道解码一个巨大的json对象而不是100个较小的json对象是否更快(假设这个大的json是通过嵌套小的json对象而制作的)。 Anyone had similar issue ? 有人遇到过类似的问题吗?

You will nearly have the same performance with your two methods. 这两种方法的性能几乎相同。

Check your requests time execution and response time with Firebug or similar. 使用Firebug或类似工具检查您的请求时间执行和响应时间。

After your test, it seems that your big json is slower than multiple mini json. 经过测试后,您的大型json似乎比多个迷你json慢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM