# Comments within code

- Thread: https://externals.io/message/1166
- Original archive: https://news-web.php.net/php.internals/1166
- Started by Oto Hlincik on 2003-05-02T16:22:02+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #1166 — Oto Hlincik — 2003-05-02T16:22:02+00:00

URL: https://externals.io/message/1166#1166

Quick Question...

How does a large amount of Comments within code (especially Class
definitions) affect script performance?

Thanks,

Oto Hlincik

---

## #1171 — Derick Rethans — 2003-05-02T16:56:45+00:00

URL: https://externals.io/message/1166#1171 · In reply to: #1166

> Quick Question...
> 
> How does a large amount of Comments within code (especially Class
> definitions) affect script performance?

Not that much, it's mostly the reading of it that will take the most 
time. It can't be an excuse to not document your code ;)

Derick

-- 
                                        "my other box is your windows PC"
-------------------------------------------------------------------------
 Derick Rethans                                 http://derickrethans.nl/ 
 PHP Magazine - PHP Magazine for Professionals       http://php-mag.net/

---

## #1175 — Ilia A. — 2003-05-02T17:16:48+00:00

URL: https://externals.io/message/1166#1175 · In reply to: #1171

> 
> > […]
>
> Not that much, it's mostly the reading of it that will take the most
> time. It can't be an excuse to not document your code ;)
>
> Derick

If 40%+ of your total script size are comments you may see something like a 
2-4% performance boost if you remove those comments for files >40kb. However, 
this should not be used as an excuse not to write comments and if you are 
using an opcode compiler the difference is NILL. However, if you absolutely 
must remove the comments & other useless white space. Before putting your 
script into a production enviroment run it via 'php -w script_name.php', this 
will strip out the whitespace and dump you the stripped file to stdout.

Ilia

---

## #1190 — moshe doron — 2003-05-03T20:17:37+00:00

URL: https://externals.io/message/1166#1190 · In reply to: #1171

> Not that much, it's mostly the reading of it that will take the most 

well, it's quite depended on the comments form[1] ;)

[1] http://bugs.php.net/bug.php?id=23285

--
moshe
