Hello,
I would like to keep my comments outside the source files. I'm looking for some handy online solutions, but haven't figured out anything good so far.
Basically instead of having lots of comments in a class I would like to explain the class structure and functionality online so that the comments won't slow down the whole app. I tried running the app with and without comments and the speed difference was 8.9% which I think is enough to consider from moving the comments away from the source code!
Keeping PHP source comments outside of the files, where?
Moderator: General Moderators
- kaisellgren
- DevNet Resident
- Posts: 1675
- Joined: Sat Jan 07, 2006 5:52 am
- Location: Lahti, Finland.
Re: Keeping PHP source comments outside of the files, where?
You should definitely not move comments away from your files, unless you never intend for any other developers to maintain your code.
You can do one of two things (or both):
1. Grep your files when they are deployed in production to strip out comments (a simple shell script)
2. Use APC or any other op-code cache. Your scripts are cached in their compiled state, in which comments are no longer a factor. This will have significant performance advantages regardless.
You can do one of two things (or both):
1. Grep your files when they are deployed in production to strip out comments (a simple shell script)
2. Use APC or any other op-code cache. Your scripts are cached in their compiled state, in which comments are no longer a factor. This will have significant performance advantages regardless.
- kaisellgren
- DevNet Resident
- Posts: 1675
- Joined: Sat Jan 07, 2006 5:52 am
- Location: Lahti, Finland.
Re: Keeping PHP source comments outside of the files, where?
2. Not possible.pytrin wrote:You should definitely not move comments away from your files, unless you never intend for any other developers to maintain your code.
You can do one of two things (or both):
1. Grep your files when they are deployed in production to strip out comments (a simple shell script)
2. Use APC or any other op-code cache. Your scripts are cached in their compiled state, in which comments are no longer a factor. This will have significant performance advantages regardless.
1. I could do that, I'll probably then have two different versions of my software: dev and the regular one. It's just that it adds extra pain to maintain two different systems since I have lots of nasty things going on such as automatic source code updating, etc. So it's a bit pain in the smurf
Re: Keeping PHP source comments outside of the files, where?
Actually, if you use a versioning system such as SVN, it's easier. You can have the grep script run in a post-commit hook automatically.