This is a heads up for what is going on on the glsl-pp-rework-2 feature
branch.
The goal was to rewrite the existing processor for GLSL compiler as a
stepping stone for a better GLSL compiler in general. Make it faster,
easy to understand and maintain. But the most important thing was to
make it easy to plug a new syntax parser in the future (Ian has started
some work towards this). That's done.
The next step was to integrate the new processor with the existing
syntax parser to allow me to measure compiler performance. The results
were not very satisfying -- it turned out the syntax parser was such a
huge bottleneck, it did not matter how fast the processor was.
So I just hacked up a simple and fast syntax parser that basically
emulates the old one, so that we don't have to touch too much code,
spend too much time on it and intruduce regressions. It's not perfect,
it looks ugly but it works well. I don't mind scrapping it and replacing
with a new, bison-based parser. And for the time being, here are the
numbers.
The benchmark takes CorrectConstFolding2.vert shader from the GLSL
Compiler Test suite. It's one of the biggest files with around 400 lines
of code. What is being timed is processing + syntax parsing, so no
further semantic checking and code generation is taken into account.
old 128,157 us
new 4,719 us
improvement 27 x
After that the new processor becomes the bottleneck. That means it's
worthwile to keep on improving it. If the processing step is taken
out of the equation and we only measure the syntax parsing stage, we get
the following numbers.
old 124,671
new 1,016
improvement 122 x
The code for the new parse should be in mesa repository in a week or so.
Thanks.
|