摘要: 1. If a method c++an be static, declare it static. Speed improvement is by a factor of 4. 如果一个方法可静态化,就对它做静态声明。速率可提升至4倍。 2. echo is faster than print. echo 比 print 快。 3. Use echo's multiple parameters instead of string concatenation. 使用echo的多重参数(译注:指用逗号而不是句点)代替字符串连接。 4. Set the maxvalue for your 阅读全文
posted @ 2014-02-13 10:54 宫本峻淏-龙二 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 1.fopen /file_get_contents每次请求都会重新做DNS查询,并不对 DNS信息进行缓存。但是CURL会自动对DNS信息进行缓存。对同一域名下的网页或者图片的请求只需要一次DNS查询。这大大减少了DNS查询的次数。 所以CURL的性能比fopen /file_get_contents好很多。2.fopen /file_get_contents在请求HTTP时,使用的是http_fopen_wrapper,不会keeplive。而curl却可以。这样在多次请求多个链接时,curl效率会好一些。3.fopen / file_get_contents函数会受到php.ini文件中 阅读全文
posted @ 2014-02-13 10:43 宫本峻淏-龙二 阅读(368) 评论(0) 推荐(1) 编辑