I've seen a few people ask this question in the past. I freely admit that HeroStats takes a good long time to start up initially. And to make matters worse, while it's starting, it eats up most of your CPU so other programs are impacted. So why does this happen?
The answer, as in most programming, comes down to a trade-off. HeroStats makes heavy use of regular expressions (also known as regexs) to parse the text of the combat log into the stats that everyone wants. Regexs are a great way to recognize text messages and get information out of them, but they require a good deal of setup time if you want them to run quickly. This is known as compiling the regexs and it takes a lot of your computer's CPU time.
And we certainly want them to run quickly. HeroStats scans the CoX client chat tabs twice every second to look for new messages. Every time a new message is found, we have to run through the regexs to figure out what that message means. The code is pretty smart about checking the most common regexs first, but it can still take quite a while to go through them all, especially if your message happens to be one that isn't used very often.
So we want the regexs to run quickly, but in order to do that we need to spend the time to set them up first. And this is why your HeroStats takes a while to start up. It's loading up all those regexs so that while you're actually playing the game, your statistics/timers/etc. are being pulled quickly from those log messages.
Friday, January 4, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment