Thursday, February 5, 2009
I love Binary Chop :D
So i finally tackled the big "server_param" message. It contains 153 variables so my first approach was to just make 153 if/else statements and use a for loop and the java string splitter as mentioned before. This turned out to be 11,781 operations which is not good. I'm sure it would work but i couldn't leave it like that so i decided to use binary chop and then sort by most occurences. This has brought the parsing down to at most 20*153 which is 3060 opperations but as this is worst case and we have sorted according to higher occurances it will be signifigantly less which is a saving of a lot of opperations. I'm sure i could get this down to 153 operations but my current method will allow for my method to be easily adjusted to handle future "server_param" messages which may have been reordered or even extended. Just have to get the "see" and "sense_body" game time messages done now, I am going to look into recursion for them as they need to be uber fast.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment