TLDR
(Original TLDR at the end of this comment)
While I was working on removing regexes from parsers, I noticed that the speed gain and reduced usage was not as much as I expected it to be. So I decided to rework the parsers completely, instead of just removing regexes.
For more complex parsers, such as the character one, I'm gonna start by removing the regexes and later try to rewrite it completely. As this is a far more complex task and removing the regexes is already a huge performance boost for such parsers.
But for boostable bosses, for example, while removing regexes gave a 50% speed boost and reduced allocations by 4% rewriting the parser was relatively simple and gave a 98% speed boost while reducing allocations by almost 100%
Files to remove regex from or rewrite parsers:
TibiaBoostableBossesOverview
TibiaCharactersCharacter
TibiaCreaturesCreature
TibiaCreaturesOverview
TibiaDataUtils
TibiaFansites
TibiaGuildsGuild
TibiaHighscores
TibiaHousesHouse
TibiaHousesOverview
TibiaNews
TibiaSpellsSpell
TibiaWorldsOverview
TibiaWorldsWorld
tibia
Original TLDR
I decided to open this issue in order to track the progress of removing all regex from the system.
Reducing the amount of regex is beneficial for two main reasons:
- Speed
- When parsing without regex, it is quicker
- Heap Allocations
- Even though we already made the regexes sentinel value, not having to compile them on every iteration, using the compiled regex still make heap allocations. So, by removing regexes completely we reduce a lot of heap allocations, thus reducing the GC load.
TLDR
(Original TLDR at the end of this comment)
While I was working on removing regexes from parsers, I noticed that the speed gain and reduced usage was not as much as I expected it to be. So I decided to rework the parsers completely, instead of just removing regexes.
For more complex parsers, such as the character one, I'm gonna start by removing the regexes and later try to rewrite it completely. As this is a far more complex task and removing the regexes is already a huge performance boost for such parsers.
But for boostable bosses, for example, while removing regexes gave a 50% speed boost and reduced allocations by 4% rewriting the parser was relatively simple and gave a 98% speed boost while reducing allocations by almost 100%
Files to remove regex from or rewrite parsers:
TibiaBoostableBossesOverview
TibiaCharactersCharacter
TibiaCreaturesCreature
TibiaCreaturesOverview
TibiaDataUtils
TibiaFansites
TibiaGuildsGuild
TibiaHighscores
TibiaHousesHouse
TibiaHousesOverview
TibiaNews
TibiaSpellsSpell
TibiaWorldsOverview
TibiaWorldsWorld
tibia
Original TLDR