Tuesday, February 12, 2013

Reducing build time on VisualStudio

I was working on a project recently where there was a statically allocated array (a lookup table of sorts) that was used in the code. I declared the array as follows:
float lookupTable[512][512]={{0.3423f,0.23453f, .... }
To my surprise, visual studio build process stuck as soon as the source file containing this table was build. I went online to see how to solve this issue and luckily I found this (http://forums.codeguru.com/showthread.php?515152-Build-with-extrememly-large-array-constant-hangs-at-quot-Generating-code-quot ) thread which mentioned to declare the array static at global /class scope and making it a const. I just did that by declaring my lut as follows:
static const float lookupTable[512][512]={{0.3423f,0.23453f, .... }
and voila, the build time reduced to virtually milliseconds.
Thought it might help others as well.

Popular Posts

Copyright (C) 2011 - Movania Muhammad Mobeen. Awesome Inc. theme. Powered by Blogger.