On Tue, 27 Apr 2004, The Mage wrote:

> LambaMOO implements comments in an unusual way, seemingly not as a 
> section marked 'don't execute' but as a string whose value is 
> unassigned to any variable or operation and is discarded instead:

Actually, in recent releases (the rogue releases or 1.8.1), the 
implementation boils down to exactly that as far as I can tell. See the 
case OP_IMM in execute.c::run().

> It looks to me that this is a consequence of the server's method of 
> compiling the code upon entry and discarding the source: no comments 
> would survive this process intact unless they were evaluated. But this 
> must have some cost in terms of execution time, mustn't it? Every 
> evaluation must take some processor cycles, and therefore 
> comment-ridden code would be: how much slower than commentless code?

That depends on a lot more than just how the bytecode interpreter handles
things. The comments take space, as does all other text (descriptions,
messages, etc.) That adds to the checkpoint costs (more file IO), to the
process size (possibly more paging, for the MOO process or for others),
and to disk space (possibly more time spent in the disk space allocator
part of the file system).

Exactly how much that would add depends on the OS, the overall workload of 
the server, the workload profile (CPU vs. disk IO vs. network IO), and how 
much overlap (eg, across disks) the server hardware and configuration 
permit.

In other words, there's no general answer to your question.

> As soon as I read of this implementation I acquired my early habit of 
> not commenting my code, not liking the idea of taking such a hit. Was 
> my fear justified.

In my opinion, no. The hit you take just from coding in MOO, as opposed to 
C (or assembler, lovingly hand-tuned for your specific hardware and 
software configuration) probably outweighs the cost of MOO comments by a 
large factor.

> I also know that I can use /* C-style comments */ so 
> long as I preserve the text files my code is stored in, and such 
> comments will not even get stored in the database (which conserves both 
> processor and memory resources).

That also means that other programmers on your MOO who only have access to 
the database don't see your comments.

-- 
"I'd ask if you'd found the right sort of isolated wasteland for your
citadel of dread yet, but that would be a silly question; you're in Utah,
after all." --ESR to Darl McBride (Chief Excessive Ossifier of Squandered 
Clues Obstination), in http://www.catb.org/~esr/writings/mcbride.html



#############################################################
This message is sent to you because you are subscribed to
  the mailing list <[EMAIL PROTECTED]>.
To unsubscribe, E-mail to: <[EMAIL PROTECTED]>
To switch to the DIGEST mode, E-mail to <[EMAIL PROTECTED]>
To switch to the INDEX mode, E-mail to <[EMAIL PROTECTED]>
Send administrative queries to  <[EMAIL PROTECTED]>

Reply via email to