imageworks/OpenShadingLanguage — pull request #287 by lgritz (2013-10-08 18:03:41+00:00)
Title: Huge speedups for OSLQuery API

Allow OSOReader subclasses to specify whether they should end parsing
upon hitting the code section and/or upon hitting the temps in the symbol
table, and have the OSO parser 'YYACCEPT' when those conditions are hit.
(N.B. Params and globals will always be first in the symbol table.)

The OSOReaderQuery subclass says, terminate parsing upon either of those
conditions. This makes OSLQuery -- used by applications to catalog the
parameters of a compiled shader, but not caring about anything else --
able to parse just the very beginning of the file and then stop.

For our most absurdly large shaders, this speeds up OSLQuery times by
20x, from about 0.9s for our very biggest shaders to < 0.04s.