PDA

View Full Version : What is the deal with visual studio?



Luuk van Venrooij
10-04-2008, 07:55 PM
Currently I work at a compagny where I`m writting a new renderer for there inhouse game engine. The engine is being developed in C++ using visual studio. It has about 300 source files between 2 and 50 kb).

When I started working there I had a temporary computer, an amd dual core 4800 with 1 gb of mem. Compiling and linking the entire engine took about 45 minutes! Now I have a new intel 6600 quadcore machine with 2 gb of mem and compiling still takes 30 minutes. We also use a program called incredibuild which let other computers aid you in compiling with there idle cpu time via the netwerk. This let`s you use up to 10 other pc`s. Linking is still done on the host machine. Even with this a complete build takes 12 minutes. And when in debug visual studio generates about 300 mb of files it uses for debug. ALso when linking, the process that does this comsumes over a gig of memory!

When I compare this with my experience with delphi this is just insane. My own engine (+- 75 source files) compiles and links in 10 to 15 second in a cleaned workspace. Also I once worked on a large database application with about 200 sourcefiles and a complete build on a single machine took about 3 minutes. Memory usage of my Delphi 2007 is between 60 and 100 mb.

Why does Visual studio needs so much power and resources? I asked this to a few seniors and none of them had any good awnser. They where even more amazed when I showed them compilation of my own engine project.

Today I did a fun expirement by recording every minute I had to wait for compiling and linking. The total count was 52 minutes! 2 complete rebuild after SVN update and a lot of 3 minutes waiting periods for building the renderer, linking the dll and testing the changes.

Can anyone shed any light on this?

technomage
10-04-2008, 08:35 PM
I don't think it's just visual studio, it's just C++. Historically because Pascal is a stricter language you can produce a very efficient compiler, a C++ compiler has to be able to sort out all the weirdness of the language during compile time. But I think Visual studio is probably partly to blame, the Intelisense files it produces for code completion are just huge and while the VC4 was quite quick the more features they put into the language the longer it will take to compile.

I use C# and C++ at work and it's a real shock to the system coming from a Delphi background. Us delphi programmers think nothing of doing a full rebuild, and a normal compile is just lightning fast, and I won't mention Syntax checking (which you don't get with C++) :).

One thing I have found the speeds up compile time is not to compile in the IDE and also make use of compressed folders for the project it cuts down the amount of work the hard drive will need to do as the object files are compressed before being written to disk .

jasonf
10-04-2008, 08:36 PM
I can't shed any light on it.. but I can question the sanity of asking "Why is a Microsoft product being cruel and unusual to me?" :lol:

To be fair to the MS devs, I'm sure there's a good reason behind it.. but I'll be damned if I know what it is. In my experience, MS C++ has always been slow to build.

The build machine isn't running McAffee Crippleware is it?

Robert Kosek
10-04-2008, 08:46 PM
I know lots of C++ programmers, and I can shed some light here.

C++ is the problem, not Visual Studio. You can use any C++ compiler and encounter this exact problem. It's just wayyyyy slow.

arthurprs
10-04-2008, 08:47 PM
yes, c++ is like, takes 30sec to compile something that takes 3sec on delphi

-.-

waran
10-04-2008, 08:49 PM
technomage already answered your question; I would outline it this way:

C (or even C++) is a very complicated language - not only to the programmer
but to the compiler also. So any C++-compiler you will try (GCC and so on):
They all will be incredible slow compared to Delphi.

I don't know if "stricter" is the right word - C++ isn't loose but dealing with
headers (not modules) produces an awful lot of overhead.
Also Cs context-sensitive stuff requires lots of attention on either
compiler and programmers side.

BTW.: The fact that C++ is very complicated to the compiler makes it also
impossible to produce a well optimized binary. So writing fast programs in C
requires quite much skill and deep knowledge of your code.

Lets face it: C was never designed for applications; but Stroustroup didn't understand that :roll:
Pascal neither is designed for applications; but its good enough (credit goes mainly to Borland) 8)

JSoftware
10-04-2008, 09:19 PM
[Argh I was typing a large reply here but browser crashed]

Essence: A wise guy once told me that the great difference in compile and link time is that pascal historically almost always has been using recursive descent parsers and because the language itself has stricter semantics

I don't know if this actually holds true any longer, or that the answer simply is that the large c/c++ compilers have become too bloated or just optimizes alot more than other compilers. A compiler that springs to mind is TCC, Tiny C Compiler, that supposedly is 10 times faster than GCC

arthurprs
10-04-2008, 10:10 PM
something i like in C is += , -=,... we have Inc and Dec, very good, but they work only in ordinal =(

i'm sure borland does not implement it to keep the code compatible or not?

JSoftware
10-04-2008, 10:29 PM
arthurprs, just overload the inc and dec functions/operators

On fpc you can also use a compiler switch to allow C style operators such as += and the like

arthurprs
11-04-2008, 01:21 AM
arthurprs, just overload the inc and dec functions/operators

On fpc you can also use a compiler switch to allow C style operators such as += and the like
i already use them overloaded,

but why don't borland add them on system.pas -.-'??

JSoftware
11-04-2008, 05:26 AM
Because it's unofficially part of the language specification.

Do you overload them in the normal sense or have you operator overloaded them?

NecroDOME
11-04-2008, 03:02 PM
I had the same with MSVS in a code base of 900+ files. Image a total rebuild of that. (well, not all files where used, but it still took also 30-45 minutes). Delphi is indeed faster. Way faster!! And C++ barfs out a whole bunch of linker files (dunno the exact name of them, forgive me) that took over 1 GB disk space. (insane). Delphi also has DCU files, but I the are generated a lot faster.

arthurprs
11-04-2008, 05:49 PM
Because it's unofficially part of the language specification.

Do you overload them in the normal sense or have you operator overloaded them?

i have a utils.pas (normal sense)
with overloaded inc functions for single and double (only need those)
and i also writed a Mult function :?

chronozphere
11-04-2008, 07:22 PM
Yeah.. kudo's for borland and their pascal compiler. 8)

I will only learn C++ because it's the industry standard, not because i like it. I tried Dev-C++ but there were some major problems with it, when using vista. I also noticed that the compile-time errors were really obscure IMHO, when compared with clean understandable delphi errors.

I also don't like the the seperate headers and source files. Does it have advantages to have those seperated? It sure gives you a lot of extra files to take care of. Personally i also don't like the case-sensitivity in the language. And finally, i noticed that many people complain about the use of pointers within the language. Being forced to use pointers is IMHO "a really bad thing".

Just out of curiosity Any of you guy's ever done a "nightly build" when working on a pascal project?? :razz:

Nevertheless, i would like to try C++ and learn to use it. What IDE/Compiler do you guy's recommend?? :?

arthurprs
11-04-2008, 08:17 PM
I will only learn C++ because it's the industry standard
same here



I also noticed that the compile-time errors were really obscure IMHO, when compared with clean understandable delphi errors.

do already tried compile some 3rd party library's? (when i was trying to compile mpg123, i spent a moth fixing some files)



I also don't like the the seperate headers and source files. Does it have advantages to have those seperated?
advantage, i don't see any, only more files to worry about..

tons of pointers, case sens., .... , ...,
the lack of a decent string type is another problem....

ps: another thing i like in C is sscanf()

noeska
12-04-2008, 02:14 PM
How good is borlands cpp compiler? Does it beat ms and gnu?

arthurprs
12-04-2008, 04:23 PM
How good is borlands cpp compiler? Does it beat ms and gnu?

maybe for compile speed, but runtime speed its a disaster (tested on bds 2006 cpp compiler and vc++2005)