[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: Documenting ssc contributions: efficiency for Man and machine
R. Allan Reese <R.A.Reese@hull.ac.uk> worries that comments interspersed in
code might cause Stata execute the code more slowly,
> [especially] if to slow down if comments are included in, say, an inner
Allan is so concerned about ths potential problem he is even thinking about
submitting two versions to SSC, one with, and one without comments!
That will not be necessary. When Stata reads ado-files from disk into memory,
Stata does not store the comments. Allan is right that comments would cause
an intepretive language to slow down. Stata strips the comments for Allan.
The only cost to comments is the time it takes Stata to read them from disk
and discard them, which is not much. If, however, Allan feels obligated to
write an essay (which I sometimes do), I suggest he go to the bottom of the
file, add an -exit-, and then write away. That will keep Stata from even
having to read the lines.
By the way, Allan also wrote,
> It was recently reported on this list that Bill Gould thinks that programs
> should not need comments.
That is not my position, although it is quite possible that I said the above
because, to make a point, I have been known to exaggerate. My position is
that good variable names and clean style make unnecessary many comments, and
too many comments that I see repeat exactly what the code already says.
se = result /* assign result to se */
A good cooment adds information not shown, or often hidden, in the code.
* For searches and help try: