PP: Non-functional: Only use string <-> atom mapping when needed.
Also, eliminate the 'atom' field of TPpToken. Parsing a real 300 line shader, through to making the AST, is about 10% faster. Memory is slightly reduced (< 1%). The whole google-test suite, inclusive of all testing overhead, SPIR-V generation, etc., runs 3% faster. Since this is a code *simplification* that leads to perf. improvement, I'm not going to invest too much more in measuring the perf. than this. The PP code is simply now in a better state to see how to further rationalize/improve it.
This commit is contained in:
parent
54af2de761
commit
907aabb6b0
7 changed files with 74 additions and 63 deletions
|
|
@ -92,7 +92,7 @@ namespace glslang {
|
|||
|
||||
class TPpToken {
|
||||
public:
|
||||
TPpToken() : space(false), ival(0), dval(0.0), i64val(0), atom(0)
|
||||
TPpToken() : space(false), ival(0), dval(0.0), i64val(0)
|
||||
{
|
||||
loc.init();
|
||||
name[0] = 0;
|
||||
|
|
@ -112,7 +112,6 @@ public:
|
|||
int ival;
|
||||
double dval;
|
||||
long long i64val;
|
||||
int atom;
|
||||
char name[MaxTokenLength + 1];
|
||||
};
|
||||
|
||||
|
|
@ -551,6 +550,7 @@ protected:
|
|||
int nextAtom;
|
||||
void InitAtomTable();
|
||||
void AddAtomFixed(const char* s, int atom);
|
||||
int LookUpString(const char* s);
|
||||
int LookUpAddString(const char* s);
|
||||
const char* GetAtomString(int atom);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue