Fog Creek Software
g
Discussion Board




No ASP Comments?

I got dragged into a third party code review for some friends who had an IIS / VBScript / ASP / MSSQL site developed. One of the first things I noticed was a complete lack of documentation (no shock) and also a complete lack of comments in the ASP and SQL code (unpleasant, but, again, no shock).

What sort of stunned me, though, was that when asked about the lack of comments, the author declared he would not use inline comments in ASP "due to its interruptive nature, which may show up under stress."

If you'll forgive the question - does anyone have any comments? I've certainly never heard this one before.

Mongo
Monday, January 5, 2004

That's ridiculous. There is no performance reason not to include ASP comments.

Joel Spolsky
Monday, January 5, 2004

Is he meaning that under heavy load, the commented parts of code may cause errors? I definately don't think that would be the case.

ChrisO
Monday, January 5, 2004

ChrisO

That's how I interpret it, and I agree with Joel it sounds ridiculous. My first reaction was to ask, if the expected load is going to be so heavy that it would break ASP, why wasn't the code written in COM with MTS, say?

His response just seemed so bizarre to me that it caught me off guard, and I thought I'd post it here to see what others thought.

My own suspicion is that he got caught with his hand in the cookie jar, but won't 'fess up. 

Mongo
Monday, January 5, 2004

I submit that they DON'T show up under stress... His!


Monday, January 5, 2004

If they 'did' show up under stress can you imagine how many articles we all would have ready by now about this?

I mean really,  commented code either running or 'impacting performance' would be such a *huge* gotcha that all introductory tutorials would mention it, Java programmers like myself would laugh at ASP programmers.  etc.etc.etc.

This guy needs a clue, and the project needs another programmer

Michael Koziarski
Monday, January 5, 2004

Quite a number of years ago my company did some web contract work for a large, Redmond based company. This was NT 4.0, IIS 4.0 days mind you. They decreed that we must ship them 2 versions of the code, 1 with comments and 1 without. They would not deploy any ASP code with comments for performance reasons.

You never know, this guy may have worked in the old days when opinions like this existed and he never bothered to look up whether they were still valid.

Tango
Monday, January 5, 2004

isn't that what preprocessors are for?

mb
Monday, January 5, 2004

Are you working with the guy I used to work with?  Because he had convinced management that "Comments slow down ASP" - and I had to fight that nonsense for 2 years!

Sassy
Monday, January 5, 2004

Can anyone prove that they don't slow it down?

I mean, this is not compiled code, every time the thing runs if it has to parse out the comments, doesn't that add some execution time?

I understand that the time savings might not be HUGE, but there must be some savings.

I agree that there should be comments in code.

Wayne
Monday, January 5, 2004

It would be pretty easy to do some tests with the Web Application Stress Tool to determine if comments slow things down or not. 

SomeBody
Monday, January 5, 2004

OK, this is silly, it makes no difference at all.  Next please :)

Wayne
Monday, January 5, 2004

ASP has been mainstream for what, 6-7 years? Yet I don't recall ever seeing or hearing of an "ASP Comment Stripper" - it seems like if comments were that big a problem, we'd have them right next to the obfuscators and line number generators.
(The *proper* way to do such a thing would be to maintain your codebase with comments, and strip comments when publishing to production)

What I *have* heard is that if you comment code out in ASP, don't leave it there, and don't go overboard with comments (like having a forty line page header), but remove them all? More work than it's worth.

Philo

Philo
Monday, January 5, 2004

"I mean, this is not compiled code, every time the thing runs if it has to parse out the comments, doesn't that add some execution time?"

It's not compiled, but it's not executed from the text of the asp each time either.

When an ASP page is first loaded, it's parsed into an in memory structure. That structure is then cached. One must certainly assume that comments, since they have no functional impact on the code, are not part of this structure, and therefore have no performance impact, other than a very slight increase in the initial parsing speed the very first time a page is loaded.

Sum Dum Gai
Monday, January 5, 2004

Performance time for this snippet was the same with zero and 200 comment lines inside the loop.

<%

A = timer

for x = 1 to 10000
 
    'comments went here
   
    response.write x 
next

response.write "<br><br>" & (timer - A)

%>

Eric DeBois
Monday, January 5, 2004

There is a measurable difference between a heavily commented and a non-commented ASP file, however the difference is marginal and not really worthy of consideration -- if you are _really_ trying to eak every last cycle out of the app, then sure maybe there should be no comments, but if you're using ASP it's pretty clear that ultimate performance isn't the top priority (no this isn't an indictment of ASP, but rather that if you are at the point that you're stripping/avoiding comments because of a <1% speed improvement, maybe you need to look into custom ISAPI modules, ASP.NET, etc).

Dennis Forbes
Monday, January 5, 2004

You guys know more about this than me, but I was under the impression that the latest version of ASP *was* compiled.  Is the debate about asp 3.0 (EG Classic)?

Lee
Monday, January 5, 2004

Indeed VBScript.NET in ASP.NET is compiled, and the notes about comments are entirely inapplicable, however the lack of .NET specific comments leads me to believe that the original poster was asking specifically about ASP 3.0 ("classic"). This seems reasonable given that there are currently a tremendous number of ASP 3.0 sites in active development or maintenance.

Dennis Forbes
Monday, January 5, 2004

> the author declared he would not use inline comments in ASP "due to its interruptive nature, which may show up under stress."

This is bs. The guy who said that is probably having a long day.

Li-fan Chen
Tuesday, January 6, 2004

>When an ASP page is first loaded, it's parsed into an in memory structure. That structure is then cached.

Yes but IIS only caches the last 50 (iirc) requested pages so if you are running a number of reasonably busy sites you can overflow the cache easily enough and the parsing time becomes a factor.

However if you are down to stripping out comments to give that extra fractional speed boost you probably should be looking at changing your algorithm and getting some better hardware

bil
Tuesday, January 6, 2004

If he's worried about speed, introduce him to Visual C++ and either CGI or ISAPI modules.  CGI is slower, but ISAPI modules don't like to be changed very often, which makes them undesirable for development.

Clay Dowling
Tuesday, January 6, 2004

"due to its interruptive nature, which may show up under stress."

I'm surprised that noone has mentioned this might be a reference to how comments are interruptive to him, the programmer, and it would show up under stress to deliver on time.  Thus getting out of date comments, more bugs, etc.

Andrew Hurst
Tuesday, January 6, 2004

"Yes but IIS only caches the last 50 (iirc) requested pages so if you are running a number of reasonably busy sites you can overflow the cache easily enough and the parsing time becomes a factor."
-------------------------------

Isn't there an option in IIS to change that value?  I could SWEAR I've seen it, but I just fired up IIS manager and couldn't find it.

I agree with the gist of most of the preceding comments- stripping comments will give a negligible (if any) speed increase, and if that extra couple percent in speed is so friggin' critical, they shouldn't have that logic in ASP anyway.

John Rose
Tuesday, January 6, 2004

*  Recent Topics

*  Fog Creek Home