LanguageDev / Yoakke

A collection of libraries for implementing compilers in .NET.
Apache License 2.0
141 stars 8 forks source link

Fixed potential massive slowdown with lexer generator #115

Closed LPeter1997 closed 2 years ago

LPeter1997 commented 2 years ago

The lexer generator showed a massive slowdown around determinization, when C keywords were recognized with it. This is because - as it turns out - nearby states in the StateSets unified, meaning they were hashed with XOR, yielding values like 1, 2, 3 very frequently. The slowdown was thereby caused by the hash-set search degraded to a linear search.

This PR fixes this by assigning random positive integer values as the state ID, when generating the NFA instead of sequential numbers.

Closes #114

sonarcloud[bot] commented 2 years ago

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot E 1 Security Hotspot
Code Smell B 4 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication