POV-Ray : Newsgroups : povray.general : A couple parser performance issues/optimizations. : Re: A couple parser performance issues/optimizations. Server Time
2 May 2024 19:15:39 EDT (-0400)
  Re: A couple parser performance issues/optimizations.  
From: clipka
Date: 11 Oct 2017 06:35:43
Message: <59ddf3ff$1@news.povray.org>
Am 11.10.2017 um 11:44 schrieb Kenneth:

> 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.

It does make sense when you think of how the individual lines in an
ASCII file are actually stored.

There is no "length of line" or "pointer to end of line" stored in an
ASCII file; instead, a special character (0x0A = LF = Line Feed; Unix
convention) or sequence thereof (0x0D,0x0A = CR,LF = Carriage Return,
Line Feed; DOS/Windows convention) is used to mark the end of a line.

So even with single-line comments the parser needs to scan the text
character by character to find the end of the comment.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.