|
|
Alain <kua### [at] videotronca> wrote:
> Le 17-10-07 à 19:00, Bald Eagle a écrit :
> > William F Pokorny <ano### [at] anonymousorg> wrote:
> >>
> >> 1) Comments in inner loops are costly.
> >
> > I would not have guessed that. I had always imagined that it bailed out
> > as soon as it saw // but I guess not.
>
> It does ignore whatever is in the comment, but, it have to pace through
> the comment character by character to find exactly where it ends. In a
> loop, it add up quickly.
>
Thanks, Alain. That explains my own longer parse times when using lots of
comments in a scene, the reason for which has been a mystery to me for years--
because the documentation makes a point of saying "comments are ignored by the
raytracer" and "Use comments liberally and generously." ;-)
My own (false) understanding was that a // or /* comment indicator somehow
caused the parser to actually *skip* all of the following text, or until it hit
another 'closing' */ indicator-- kind of like a 'goto' statement in other
languages, or like POV's macro-invocation behavior, where the parser immediately
jumps to the macro itself. But it makes sense that the parser has to 'read' the
intervening text-- at least when using /* and */ --in order to know WHERE the
closing comment is! For single-line // comments, though, I would have imagined
that all the text on that particular line would BE ignored, as soon as the
parser came across a double slash // Hmm, apparently not.
I need to look through my scenes to try and eliminate as many unnecessary
comments as possible in any #while/#for loops, and in any #macros that are
called multiple times.
Post a reply to this message
|
|