开发者

small unit tests , msvc

When I do small unit tests (small exe that calls my function from my library, or calls a piece of code literally embedded before main(), it seems it takes 50 times quicker in Linux than in msvc:

1) In Linux:

vi test1.c; cut-and-paste includes. cut-and-pase code. add int main(int argc, char **argv) { declare_data; call_my_function(); } :wq! cc test1.c && ./a.out done every step takes seconds. if not, helper scripts make it seconds.

2) In msvc:

create console project. until project creation is finished, it is already more time than whole (1). paste code. fiddle with project settings. try to pass argv. try to pass different argv.

开发者_高级运维

It seems everything is x10 times much slower than in Linux.

In your experience, how small unittests can be created and done really quickly -- in seconds -- in msvc ?


Nothing is stopping you from compiling and running your MSVC code from the command line. The actual compiler is a command-line tool, so if the IDE is getting in your way, just bypass it. You could even find a Windows port of Vi, and you'd have pretty much exactly the same workflow as on Linux.

But if you choose to use a heavy-duty IDE which is designed for working with large code bases, then yes, there'll be quite a bit of overhead.

Unless you write a MSVC addin to make it faster and easier to do these things. (And if you do, please make it public, because a lot of us would find it useful. ;))


If you are using Visual C++ only for building your test(s), you can use MinGW instead.


It looks like your after a VC++ solution, but for others who happen across this question there is the Temporary Projects feature of Visual Studio. Only certain project templates support this, not any c++ that I can find. You could create your own template? See MSDN for more information on configuring Temporary Projects, it is available in 2005 to 2010 Visual Studios.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜