Nivekk / KOS

Fully programmable autopilot mod for KSP.
Other
80 stars 30 forks source link

Store and use a pre-built Regex (where possible) #157

Closed dail8859 closed 10 years ago

dail8859 commented 10 years ago

Calling Regex.Match has to internally parse and build a new regex tree each time. This only has to build each regex once, then can just reuse it.

Nivekk commented 10 years ago

While I don't disagree with the approach, the lines you've refactored already need to be changed over to the new "Kegex" format first.

Also, kOS is slow on purpose, literally spending much of its time doing nothing in order to emulate an old computer (and to make sure it's not taking away too many resources from the game)

So if we do worry about efficiency, to my mind it should only be to solve any slowdown that KSP is experiencing at the hands of kOS, which I haven't heard any reports of yet..

dail8859 commented 10 years ago

I'll look into the Kegex format and rebase the pull request and open it again when I am ready. And I agree that kOS is not having any performance issues I've noticed, however my PC tends to have a hard time running KPS as it is, so any efficiency gained in a plugin means more CPU time for KSP and other plugins.

Although I do agree about the old computer emulation, the more time kOS takes to parse commands and build regexes is taking away resources from the game itself. If you are wanting kOS to run at a "slower" speed, eating up CPU time isn't the way to go about it.