Description
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
- TibiaCharactersCharacter: remove title regex #223
- TibiaCharactersCharacter: remove summon regex #224
- TibiaCharactersCharacter: remove death regex #225
- TibiaCharactersCharacter: remove char info regex #226
- TibiaCharactersCharacter: remove account badges regex #227
- TibiaCharactersCharacter: remove account achievements regex #228
TibiaCreaturesCreature
- CreatureDataRegex
- CreatureHitpointsRegex
- CreatureImmuneRegex
- CreatureStrongRegex
- CreatureWeakRegex
- CreatureHealedRegex
- CreatureManaRequiredRegex
- CreatureLootRegex
TibiaCreaturesOverview
- BoostedCreatureNameAndRaceRegex
- BoostedCreatureImageRegex
- CreatureInformationRegex
TibiaDataUtils
- TibiaCharactersCharacter: remove death regex #225
- removeUrlRegex
TibiaFansites
- FansiteInformationRegex
- FansiteImgTagRegex
- FansiteLanguagesRegex
- FansiteAnchorRegex
TibiaGuildsGuild
- GuildLogoRegex
- GuildWorldAndFoundationRegex
- GuildHomepageRegex
- GuildhallRegex
- GuildDisbaneRegex
- GuildMemberInformationRegex
- GuildMemberInvitesInformationRegex
TibiaHighscores
- HighscoresAgeRegex
- HighscoresPageRegex
- SevenColumnRegex
- SixColumnRegex
TibiaHousesHouse
- houseDataRegex
- housePassingRegex
- moveOutRegex
- paidUntilRegex
- houseAuctionedRegex
TibiaHousesOverview
- houseOverviewDataRegex
- houseOverviewAuctionedRegex
TibiaNews
- martelRegex
TibiaSpellsSpell
- SpellDataRowRegex
- SpellNameAndImageRegex
- SpellCooldownRegex
- SpellDescriptionRegex
TibiaWorldsOverview
- worldPlayerRecordRegex
- worldInformationRegex
- worldBattlEyeProtectedSinceRegex
TibiaWorldsWorld
- WorldDataRowRegex
- WorldRecordInformationRegex
- BattlEyeProtectedSinceRegex
- OnlinePlayerRegex
tibia
- characterNameRegex
- creatureAndSpellNameRegex
- guildNameRegex
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.