William F Pokorny <ano### [at] anonymousorg> wrote:
> A comment on local variables.
> Where you have multiple references to a local variable, the symbol
> definition and look up is likely clearer and faster.
> Where you have a local variable with only one reference, however, the
> symbol definition and look up is all overhead. There isn't any
> optimization which removes / streamlines the operations within macros.
> There's a clarity vs performance trade-off in the single reference to
> local variable case.
Thank you for testing this Bill. - And for mentioning this performance issue.
As you say it's a clarity vs performance choice. Normally I prefer to go for
clarity and readability before performance. I also think that we should try to
make it easy for new users to learn from the code in the standard libraries. So
when I made those macros I tried to make it easy to recognize the parts that are
Further I think that descriptive, non cryptic variable names serve as part of
the documentation. (Some seem to think that programming in POV-Ray's SDL is a
continuous short code contest.)
But the macros in question are not so big and complicated, so I have followed
your advice and removed all but one of the local variables that are only
I have also rewritten a few of the macros slightly and added some new ones.
> A millsion calls.
Post a reply to this message