I previously described the use of XNA's automatic content deserialization for loading my background stars from the Hipparcos catalog. This catalog contains approximately 120,000 entries, and this step was taking a significant proportion of my start-up time (over 3,000ms on a typical machine).
Shawn Hargreaves recently posted an article on efficiently loading large arrays or lists, which described the use of custom ContentTypeWriter and ContentTypeReader classes to avoid the performance hit caused by reflection.
I implemented these simple classes for my BackgroundStar type, and reduced the load time of this piece of content to approximately 100ms, an improvement of over 95%, which was nice :)
Add Comment