🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Simple Question - How do you get it to compile so fast?

Started by
6 comments, last by deadimp 18 years, 2 months ago
How does your code compile so fast??? Is it just the few (well, straightforward) #include statements? I have files with only 600 lines of code, and it takes 3 to 4 times as long to compile. Then again, I had began writing this project when I started C++, so I probably have a lot of redundant #include's that I need to remove. (Sorry for the noob-ish questions) EDIT: Or is that debugging is turned off?
Projects:> Thacmus - CMS (PHP 5, MySQL)Paused:> dgi> MegaMan X Crossfire
Advertisement
I assume you mean compiling the library, not the script files, am I right?

I actually haven't thought about it much. I didn't do anything special to get it to compile faster. I'm just doing what I'm always doing, and I've never had any problems with long compilation times.

I suppose it could have to do with the include files, and keeping the dependencies between modules as small as possible. If you can avoid including a header by simply forward declaring the class or function instead then that is better, as it will give less work to the compiler. Also, try to minimize the number of times you include the same header for a module, as the compiler may not be smart enough to know that it doesn't have to read the header file every time it encounters the #include directive.

It is not because debugging is turned off. Having debugging turned on may actually make it compile faster, as the complex compiler optimizations that are enabled in release mode are usually quite costly in time.

I'm sorry I can't give you any definite answer.

Perhaps someone else here has some hints on how to make the programs compile faster?

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

I know from looking at the code that you aren't that fond of templates. Templates can slow down compiling big time.
I think it is that he has done a great job of determining exactly when a file does or does not have to be included in a compilation unit, and when it is not required, it is not included.

You will be really surprised to see how many times say, <string> is included. Turn on verbose output to see.. it can literally be thousands of extra files included.
How do you turn on verbose compiling with Dev-C++ (MinGW)?
I tried "-v" in the compiler commands, but then it just gives me some data about the compiler settings, not the compilation.

Thanks for the help!
Projects:> Thacmus - CMS (PHP 5, MySQL)Paused:> dgi> MegaMan X Crossfire
I have no idea. I use VC++ 8.0
Quote: Original post by deadimp
How do you turn on verbose compiling with Dev-C++ (MinGW)?
I tried "-v" in the compiler commands, but then it just gives me some data about the compiler settings, not the compilation.

Thanks for the help!


You will need to add: -H under your -v flag [wink]

When you compile, go to the Compiler Log to see the header files. Here's a reference image if you need it:

Free Image Hosting at www.ImageShack.us
Thanks.
...
Holy Schnee! I only compiled one file (289 lines in source, 90 in header), and it had a crapola-ish amount of includes. To show you what I mean:
. C:/DGI/include/DGI_includes.h.. C:/Dev-Cpp/include/math.h... C:/Dev-Cpp/include/_mingw.h.. C:/Dev-Cpp/include/stdlib.h... C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include/stddef.h.. C:/Dev-Cpp/include/c++/3.4.2/backward/iostream.h... C:/Dev-Cpp/include/c++/3.4.2/backward/backward_warning.h... C:/Dev-Cpp/include/c++/3.4.2/iostream.... C:/Dev-Cpp/include/c++/3.4.2/mingw32/bits/c++config.h..... C:/Dev-Cpp/include/c++/3.4.2/mingw32/bits/os_defines.h.... C:/Dev-Cpp/include/c++/3.4.2/ostream..... C:/Dev-Cpp/include/c++/3.4.2/ios...... C:/Dev-Cpp/include/c++/3.4.2/iosfwd....... C:/Dev-Cpp/include/c++/3.4.2/mingw32/bits/c++locale.h........ C:/Dev-Cpp/include/c++/3.4.2/clocale......... C:/Dev-Cpp/include/locale.h.......... C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include/stddef.h.......... C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include/stddef.h........ C:/Dev-Cpp/include/c++/3.4.2/cstring......... C:/Dev-Cpp/include/c++/3.4.2/cstddef.......... C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include/stddef.h......... C:/Dev-Cpp/include/string.h.......... C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include/stddef.h........ C:/Dev-Cpp/include/c++/3.4.2/cstdio......... C:/Dev-Cpp/include/stdio.h.......... C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include/stddef.h.......... C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include/stdarg.h.......... C:/Dev-Cpp/include/sys/types.h........... C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include/stddef.h....... C:/Dev-Cpp/include/c++/3.4.2/mingw32/bits/c++io.h........ C:/Dev-Cpp/include/c++/3.4.2/mingw32/bits/gthr.h......... C:/Dev-Cpp/include/c++/3.4.2/mingw32/bits/gthr-default.h.......... C:/Dev-Cpp/include/errno.h....... C:/Dev-Cpp/include/c++/3.4.2/cctype........ C:/Dev-Cpp/include/ctype.h......... C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include/stddef.h....... C:/Dev-Cpp/include/c++/3.4.2/bits/stringfwd.h....... C:/Dev-Cpp/include/c++/3.4.2/bits/postypes.h........ C:/Dev-Cpp/include/c++/3.4.2/cwchar......... C:/Dev-Cpp/include/c++/3.4.2/ctime.......... C:/Dev-Cpp/include/time.h........... C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include/stddef.h......... C:/Dev-Cpp/include/wchar.h.......... C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include/stddef.h.......... C:/Dev-Cpp/include/wctype.h........... C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include/stddef.h.......... C:/Dev-Cpp/include/stdint.h........... C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include/stddef.h....... C:/Dev-Cpp/include/c++/3.4.2/bits/functexcept.h........ C:/Dev-Cpp/include/c++/3.4.2/exception_defines.h...... C:/Dev-Cpp/include/c++/3.4.2/exception...... C:/Dev-Cpp/include/c++/3.4.2/bits/char_traits.h....... C:/Dev-Cpp/include/c++/3.4.2/bits/stl_algobase.h........ C:/Dev-Cpp/include/c++/3.4.2/climits......... C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include/limits.h.......... C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include/syslimits.h........... C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include/limits.h............ C:/Dev-Cpp/include/limits.h........ C:/Dev-Cpp/include/c++/3.4.2/cstdlib........ C:/Dev-Cpp/include/c++/3.4.2/new........ C:/Dev-Cpp/include/c++/3.4.2/bits/stl_pair.h........ C:/Dev-Cpp/include/c++/3.4.2/bits/type_traits.h........ C:/Dev-Cpp/include/c++/3.4.2/bits/stl_iterator_base_types.h........ C:/Dev-Cpp/include/c++/3.4.2/bits/stl_iterator_base_funcs.h......... C:/Dev-Cpp/include/c++/3.4.2/bits/concept_check.h........ C:/Dev-Cpp/include/c++/3.4.2/bits/stl_iterator.h........ C:/Dev-Cpp/include/c++/3.4.2/debug/debug.h......... C:/Dev-Cpp/include/c++/3.4.2/cassert.......... C:/Dev-Cpp/include/assert.h......... C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include/stddef.h...... C:/Dev-Cpp/include/c++/3.4.2/bits/localefwd.h....... C:/Dev-Cpp/include/c++/3.4.2/bits/functexcept.h...... C:/Dev-Cpp/include/c++/3.4.2/bits/ios_base.h....... C:/Dev-Cpp/include/c++/3.4.2/bits/atomicity.h........ C:/Dev-Cpp/include/c++/3.4.2/mingw32/bits/atomic_word.h....... C:/Dev-Cpp/include/c++/3.4.2/bits/locale_classes.h........ C:/Dev-Cpp/include/c++/3.4.2/string......... C:/Dev-Cpp/include/c++/3.4.2/memory.......... C:/Dev-Cpp/include/c++/3.4.2/bits/allocator.h........... C:/Dev-Cpp/include/c++/3.4.2/mingw32/bits/c++allocator.h............ C:/Dev-Cpp/include/c++/3.4.2/ext/new_allocator.h.......... C:/Dev-Cpp/include/c++/3.4.2/bits/stl_construct.h.......... C:/Dev-Cpp/include/c++/3.4.2/bits/stl_uninitialized.h.......... C:/Dev-Cpp/include/c++/3.4.2/bits/stl_raw_storage_iter.h......... C:/Dev-Cpp/include/c++/3.4.2/bits/stl_function.h......... C:/Dev-Cpp/include/c++/3.4.2/bits/basic_string.h......... C:/Dev-Cpp/include/c++/3.4.2/algorithm.......... C:/Dev-Cpp/include/c++/3.4.2/bits/stl_algo.h........... C:/Dev-Cpp/include/c++/3.4.2/bits/stl_heap.h........... C:/Dev-Cpp/include/c++/3.4.2/bits/stl_tempbuf.h......... C:/Dev-Cpp/include/c++/3.4.2/bits/basic_string.tcc...... C:/Dev-Cpp/include/c++/3.4.2/streambuf....... C:/Dev-Cpp/include/c++/3.4.2/bits/streambuf.tcc...... C:/Dev-Cpp/include/c++/3.4.2/bits/basic_ios.h....... C:/Dev-Cpp/include/c++/3.4.2/bits/streambuf_iterator.h....... C:/Dev-Cpp/include/c++/3.4.2/bits/locale_facets.h........ C:/Dev-Cpp/include/c++/3.4.2/cwctype........ C:/Dev-Cpp/include/c++/3.4.2/mingw32/bits/ctype_base.h........ C:/Dev-Cpp/include/c++/3.4.2/mingw32/bits/ctype_inline.h........ C:/Dev-Cpp/include/c++/3.4.2/bits/codecvt.h........ C:/Dev-Cpp/include/c++/3.4.2/mingw32/bits/time_members.h........ C:/Dev-Cpp/include/c++/3.4.2/mingw32/bits/messages_members.h....... C:/Dev-Cpp/include/c++/3.4.2/bits/basic_ios.tcc..... C:/Dev-Cpp/include/c++/3.4.2/bits/ostream.tcc...... C:/Dev-Cpp/include/c++/3.4.2/locale....... C:/Dev-Cpp/include/c++/3.4.2/bits/locale_facets.tcc........ C:/Dev-Cpp/include/c++/3.4.2/limits........ C:/Dev-Cpp/include/c++/3.4.2/typeinfo.... C:/Dev-Cpp/include/c++/3.4.2/istream..... C:/Dev-Cpp/include/c++/3.4.2/bits/istream.tcc.. C:/Dev-Cpp/include/c++/3.4.2/backward/fstream.h... C:/Dev-Cpp/include/c++/3.4.2/fstream.... C:/Dev-Cpp/include/c++/3.4.2/mingw32/bits/basic_file.h.... C:/Dev-Cpp/include/c++/3.4.2/bits/fstream.tcc.. C:/Dev-Cpp/include/direct.h... C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include/stddef.h... C:/Dev-Cpp/include/io.h.. C:/Dev-Cpp/include/c++/3.4.2/vector... C:/Dev-Cpp/include/c++/3.4.2/bits/functexcept.h... C:/Dev-Cpp/include/c++/3.4.2/bits/stl_vector.h.... C:/Dev-Cpp/include/c++/3.4.2/bits/functexcept.h... C:/Dev-Cpp/include/c++/3.4.2/bits/stl_bvector.h... C:/Dev-Cpp/include/c++/3.4.2/bits/vector.tcc.. C:/Dev-Cpp/include/c++/3.4.2/map... C:/Dev-Cpp/include/c++/3.4.2/bits/stl_tree.h.... C:/Dev-Cpp/include/c++/3.4.2/bits/cpp_type_traits.h... C:/Dev-Cpp/include/c++/3.4.2/bits/stl_map.h... C:/Dev-Cpp/include/c++/3.4.2/bits/stl_multimap.h.. C:/Dev-Cpp/include/windows.h... C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include/stdarg.h... C:/Dev-Cpp/include/windef.h.... C:/Dev-Cpp/include/winnt.h..... C:/Dev-Cpp/include/winerror.h..... C:/Dev-Cpp/include/basetsd.h..... C:/Dev-Cpp/include/pshpack4.h..... C:/Dev-Cpp/include/poppack.h... C:/Dev-Cpp/include/wincon.h... C:/Dev-Cpp/include/winbase.h... C:/Dev-Cpp/include/wingdi.h... C:/Dev-Cpp/include/winuser.h... C:/Dev-Cpp/include/winnls.h... C:/Dev-Cpp/include/winver.h... C:/Dev-Cpp/include/winnetwk.h... C:/Dev-Cpp/include/winreg.h... C:/Dev-Cpp/include/winsvc.h.. C:/Dev-Cpp/include/d3d9.h... C:/Dev-Cpp/include/objbase.h.... C:/Dev-Cpp/include/rpc.h..... C:/Dev-Cpp/include/rpcdce.h...... C:/Dev-Cpp/include/basetyps.h...... C:/Dev-Cpp/include/rpcdcep.h..... C:/Dev-Cpp/include/rpcnsi.h..... C:/Dev-Cpp/include/rpcnterr.h.... C:/Dev-Cpp/include/rpcndr.h..... C:/Dev-Cpp/include/rpcnsip.h..... C:/Dev-Cpp/include/objfwd.h.... C:/Dev-Cpp/include/wtypes.h..... C:/Dev-Cpp/include/rpc.h.... C:/Dev-Cpp/include/unknwn.h..... C:/Dev-Cpp/include/wtypes.h...... C:/Dev-Cpp/include/rpc.h.... C:/Dev-Cpp/include/objidl.h.... C:/Dev-Cpp/include/cguid.h... C:/Dev-Cpp/include/d3d9types.h.... C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include/float.h... C:/Dev-Cpp/include/d3d9caps.h.. C:/Dev-Cpp/include/d3dx9tex.h... C:/Dev-Cpp/include/d3dx9.h.... C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include/limits.h.... C:/Dev-Cpp/include/d3dx9math.h..... C:/Dev-Cpp/include/d3dx9.h..... C:/Dev-Cpp/include/d3dx9math.inl.... C:/Dev-Cpp/include/d3dx9core.h..... C:/Dev-Cpp/include/d3dx9.h.... C:/Dev-Cpp/include/d3dx9mesh.h..... C:/Dev-Cpp/include/d3dx9.h..... C:/Dev-Cpp/include/dxfile.h.... C:/Dev-Cpp/include/d3dx9tex.h..... C:/Dev-Cpp/include/d3dx9.h.... C:/Dev-Cpp/include/d3dx9shader.h..... C:/Dev-Cpp/include/d3dx9.h.... C:/Dev-Cpp/include/d3dx9effect.h..... C:/Dev-Cpp/include/d3dx9.h.... C:/Dev-Cpp/include/d3dx9shape.h..... C:/Dev-Cpp/include/d3dx9.h.... C:/Dev-Cpp/include/d3dx9anim.h.. C:/Dev-Cpp/include/dxerr9.h.. C:/Dev-Cpp/include/dinput.h... C:/Dev-Cpp/include/objbase.h.... C:/Dev-Cpp/include/rpc.h.. C:/Dev-Cpp/include/ole2.h... C:/Dev-Cpp/include/objbase.h.... C:/Dev-Cpp/include/rpc.h... C:/Dev-Cpp/include/olectlid.h... C:/Dev-Cpp/include/oleauto.h.... C:/Dev-Cpp/include/oaidl.h... C:/Dev-Cpp/include/oleidl.h.. C:/Dev-Cpp/include/dmusici.h... C:/Dev-Cpp/include/objbase.h.... C:/Dev-Cpp/include/rpc.h... C:/Dev-Cpp/include/mmsystem.h... C:/Dev-Cpp/include/dmusicc.h.... C:/Dev-Cpp/include/objbase.h..... C:/Dev-Cpp/include/rpc.h.... C:/Dev-Cpp/include/dls1.h.... C:/Dev-Cpp/include/dmerror.h.... C:/Dev-Cpp/include/dmdls.h.... C:/Dev-Cpp/include/dsound.h..... C:/Dev-Cpp/include/objbase.h...... C:/Dev-Cpp/include/rpc.h.... C:/Dev-Cpp/include/dmusbuff.h..... C:/Dev-Cpp/include/pshpack4.h..... C:/Dev-Cpp/include/poppack.h.... C:/Dev-Cpp/include/pshpack8.h.... C:/Dev-Cpp/include/poppack.h... C:/Dev-Cpp/include/dmplugin.h.... C:/Dev-Cpp/include/objbase.h..... C:/Dev-Cpp/include/rpc.h.... C:/Dev-Cpp/include/dmusici.h.... C:/Dev-Cpp/include/pshpack8.h.... C:/Dev-Cpp/include/poppack.h... C:/Dev-Cpp/include/pshpack8.h... C:/Dev-Cpp/include/poppack.h. C:/DGI/include/DGI_log.h.. C:/DGI/include/DGI_includes.h. C:/DGI/include/DGI_main.h. C:/DGI/include/DGI_math.h. C:/DGI/include/DGI_graphics.h.. C:/DGI/include/DGI_gcommon.h. C:/DGI/include/DGI_gfunc.h. C:/DGI/include/DGI_room.h.. C:/DGI/include/DGI_views.h.. C:/DGI/include/DGI_objects.h... C:/DGI/include/DGI_objects.h... C:/DGI/include/DGI_sprites.h.... C:/DGI/include/DGI_resource.h..... C:/DGI/include/DGI_math.h.. C:/DGI/include/DGI_gobjects.h... C:/DGI/include/DGI_room.h. C:/DGI/include/DGI_views.h

...Crap.
Projects:> Thacmus - CMS (PHP 5, MySQL)Paused:> dgi> MegaMan X Crossfire

This topic is closed to new replies.

Advertisement