Do php comments take server time?

2019-07-04 19:26发布

I am working on speeding up the response time of the website I'm currently working on. Can anyone tell me if the php parser takes the time to look at the code within comment blocks, or is it completely ignored? I ask because I'm wondering if removing many large blocks of commented code would do anything to improve page rendering time. Thanks.

8条回答
劫难
2楼-- · 2019-07-04 19:54

Search Php hip hop. Facebook uses it to compile Php to native code. Its very fast.

查看更多
疯言疯语
3楼-- · 2019-07-04 20:03

They're ignored. The PHP tokenizer essentially jumps right over them.

查看更多
神经病院院长
4楼-- · 2019-07-04 20:06

You might be able to ditch a single $2,000 server if you had Facebook's 500,000,000 users. For most sites, though, you've wasted more billable time considering the issue than you'll realize in a century's worth of cost savings.

查看更多
姐就是有狂的资本
5楼-- · 2019-07-04 20:07

accelerator (eaccelerator, xcache, apc or simialar) will make a big difference on big php-files.

It may be a db-related issue though. (indexes??)

Keep your comments, you will forget or someone will take over.

查看更多
萌系小妹纸
6楼-- · 2019-07-04 20:11

If you want to improve PHP performance, install bytecode cache (such as apc). That would make PHP not to recompile files every time

查看更多
Melony?
7楼-- · 2019-07-04 20:12

parse rules for "jumping" over comments are well established and extremely low-overhead. removing comments will save a miniscule sliver of processing time, but you will never notice it.

and the time consumed trying to read code without comments will be a far greater penalty down the road.

查看更多
登录 后发表回答