{"id":580,"date":"2009-06-21T23:41:45","date_gmt":"2009-06-21T13:41:45","guid":{"rendered":"http:\/\/www.vectorstorm.org\/?p=580"},"modified":"2009-06-21T23:42:10","modified_gmt":"2009-06-21T13:42:10","slug":"on-optimisations","status":"publish","type":"post","link":"https:\/\/www.vectorstorm.com.au\/2009\/06\/21\/on-optimisations\/","title":{"rendered":"On Optimisations"},"content":{"rendered":"
There’s an old maxim amongst programmers, that premature optimisation is the root of all evil. \u00a0Or to put that in a less glib way, it’s generally a bad idea to perform optimisations before your program is completed, and it’s always a bad idea to perform optimisations if you have no way to check your performance before and after. \u00a0In practice, this means that you need to use a profiler before you start thinking about performing optimisations.<\/p>\n
So apologies,\u00a0but it’s another technical post. \u00a0For those who aren’t interested in programmer topics but are looking for pretty screenshots or discussions about game design, please feel free to skip this one. \u00a0Coders, hit the ‘Continue Reading’, below. \u00a0:)<\/p>\n
<\/p>\n
There are several different types of profiler; \u00a0some need to be built into your program, some are external applications; \u00a0there are many different types, which are useful for different things. \u00a0Under OS X (which is where I’m currently doing my active development), there’s a free standalone profiler called “Shark”. \u00a0“Shark” is a statistical profiler, which means that it stops your program hundreds or thousands times per second, and checks to see what your program is doing at each of those points in time. \u00a0Based upon statistical analyses of the data it obtains, it can figure out which bits of your program seem to be taking the longest to run.<\/p>\n
There are two things which have been annoying me about MMORPG Tycoon 2 recently; \u00a0one is how long it takes for the program to build the world when it starts up (after it opens its window, it takes about five seconds on my laptop before it’s ready to render the world), and the other is how long it takes to shut the game down (quitting takes about two and a half seconds).<\/p>\n