评论是否会影响绩效? [英] do comments impose a performance hit?

查看:65
本文介绍了评论是否会影响绩效?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个PHP应用程序,大小为2兆。其中,我猜是

200k-400k是评论。他们是否会影响性能?我已经推迟了任何一种优化,但是在某些时候我将不得不这样做。/ b
。拿出值得的评论吗?在所有优化中我可以做什么,b $ b在哪里排名?

解决方案

2005-01 -31, lk******@geocities.com < lk ****** @ geocities。 COM>写道:

我有一个PHP应用程序,其大小为2兆。其中,我猜是
200k-400k是评论。他们是否会影响性能?我一直在推迟任何类型的优化,但在某些时候我必须做到这一点。拿出值得的评论吗?在我可以做的所有优化中,它应该在哪里排名?



搜索所需的关键字是分析。

-

Met vriendelijke groeten,

Tim Van Wassenhove< http://www.timvw.info>


< blockquote> 2005年1月31日12:07:26 -0800, lk******@geocities.com 写道:

我有一个PHP应用程序,大小为2兆。其中,我猜是
200k-400k是评论。他们是否会影响性能?我一直在推迟任何类型的优化,但在某些时候我必须做到这一点。拿出值得的评论吗?在我可以做的所有优化中,它应该在哪里排名?




它应该排名倒数。不要删除评论。你可以通过修改你的算法获得数量级的订单数量差异,而删除注释可能会给你一个小的解析时间的一次性减少,但是你不会有任何意见

表示代码是如何工作的,因此需要更长的时间才能解决问题。


-

Andy Hassall /< an ** @ andyh.co.uk> /< http://www.andyh.co.uk>

< http://www.andyhsoftware.co.uk/space>空间:磁盘使用情况分析工具


lk ****** @ geocities .com 写道:

我有一个PHP应用程序,大小为2兆。其中,我猜是
200k-400k是评论。他们是否会影响性能?我一直在推迟任何类型的优化,但在某些时候我必须做到这一点。拿出值得的评论吗?在我可以做的所有优化中,它应该在哪里排名?



i如果性能命中率超过十分之几,将会感到惊讶
$ b最多$ b%。标记编程语言花费的时间

(删除注释的地方)往往很小。


但是,如果你加载2MB对于每一个传入

请求的脚本,我可能会礼貌地建议您仔细查看系统的架构:-)。
<祝你好运!祝你好运!

mark。


-

我不是一个愤怒的男人。从我的电子邮件中删除愤怒以回复。


I''ve got a PHP application that''s 2 megs in size. Of that, my guess is
200k-400k is comments. Do they impose a performance hit? I''ve been
postponing any kind of optimization, but at some point I''ll have to do
it. Is taking out the comments worth it? Of all the optimizations I can
do, where should it rank?

解决方案

On 2005-01-31, lk******@geocities.com <lk******@geocities.com> wrote:

I''ve got a PHP application that''s 2 megs in size. Of that, my guess is
200k-400k is comments. Do they impose a performance hit? I''ve been
postponing any kind of optimization, but at some point I''ll have to do
it. Is taking out the comments worth it? Of all the optimizations I can
do, where should it rank?


The keyword you need for your search is "profiling".
--
Met vriendelijke groeten,
Tim Van Wassenhove <http://www.timvw.info>


On 31 Jan 2005 12:07:26 -0800, lk******@geocities.com wrote:

I''ve got a PHP application that''s 2 megs in size. Of that, my guess is
200k-400k is comments. Do they impose a performance hit? I''ve been
postponing any kind of optimization, but at some point I''ll have to do
it. Is taking out the comments worth it? Of all the optimizations I can
do, where should it rank?



It should rank bottom. Don''t remove comments. You may get orders of magnitude
difference by fixing your algorithms, whereas removing comments may give you a
one-off small reduction in parse time, but then you don''t have any comments
indicating how the code works, so it''ll take longer to fix anything.

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool


lk******@geocities.com wrote:

I''ve got a PHP application that''s 2 megs in size. Of that, my guess is
200k-400k is comments. Do they impose a performance hit? I''ve been
postponing any kind of optimization, but at some point I''ll have to do
it. Is taking out the comments worth it? Of all the optimizations I can
do, where should it rank?


i would be surprised if the performance hit is more than a few tenths of a
percent at most. the amount of time spent tokenising programming languages
(which is where comments are stripped) tends to be quite small.

if, however, you are loading 2MB of scripts for every single incoming
request, i might politely suggest that you take a closer look at exactly
how the system is architected :-).

good luck!
mark.

--
I am not an ANGRY man. Remove the rage from my email to reply.


这篇关于评论是否会影响绩效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆