Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Speed up compilation by ramdisk?

Speed up compilation by ramdisk?

Scheduled Pinned Locked Moved C / C++ / MFC
workspacec++performancetutorialquestion
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Christof Schardt
    wrote on last edited by
    #1

    Hello, in good old Atari-days I used to love my ramdisk. On PC this doesn't seem to be a serious topic (I wonder why). Compilation-time is the dominant bottleneck for most C++-programmers. So, in times of GB-Ram: why not use a ramdisk to reduce the heavy amount of harddisk-access? Has anyone experience in setting up such an environment? (which ramdisk? how large? what moved to the ramdisk: the temp-dir? the PCH? the whole project-files? how to setup this in VC++ ? expected speed-gain?) Thanks Christof

    G D 2 Replies Last reply
    0
    • C Christof Schardt

      Hello, in good old Atari-days I used to love my ramdisk. On PC this doesn't seem to be a serious topic (I wonder why). Compilation-time is the dominant bottleneck for most C++-programmers. So, in times of GB-Ram: why not use a ramdisk to reduce the heavy amount of harddisk-access? Has anyone experience in setting up such an environment? (which ramdisk? how large? what moved to the ramdisk: the temp-dir? the PCH? the whole project-files? how to setup this in VC++ ? expected speed-gain?) Thanks Christof

      G Offline
      G Offline
      Gary R Wheeler
      wrote on last edited by
      #2

      Christof Schardt wrote:

      On PC this doesn't seem to be a serious topic

      The current generation of PC's and Windows has overall better performance when any 'extra' available RAM is left to the operating system. Windows uses a portion of free RAM as a disk cache (there's the RAM disk you wondered about). The advantage today is that the O/S manages it for you, and you don't have to worry about copying files back and forth. There are a number of things you can do to improve build performance. Make sure that any header files that don't change a lot are included in your precompiled headers. Break your projects into smaller pieces that are linked into the final application as object libraries (.LIB's), or even at runtime as DLL's. Your objective here is to reduce the amount of code that gets recompiled when you make changes, rather than to decrease the overall compile time itself. Most of the time, you are working on a small portion of the code, and don't need to recompile the whole thing.


      Software Zen: delete this;

      B 1 Reply Last reply
      0
      • C Christof Schardt

        Hello, in good old Atari-days I used to love my ramdisk. On PC this doesn't seem to be a serious topic (I wonder why). Compilation-time is the dominant bottleneck for most C++-programmers. So, in times of GB-Ram: why not use a ramdisk to reduce the heavy amount of harddisk-access? Has anyone experience in setting up such an environment? (which ramdisk? how large? what moved to the ramdisk: the temp-dir? the PCH? the whole project-files? how to setup this in VC++ ? expected speed-gain?) Thanks Christof

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        Christof Schardt wrote:

        On PC this doesn't seem to be a serious topic (I wonder why).

        I used a RAM disk exhaustively back with MS-DOS and Windows 3.x. It was a real time saver for compilations.


        "Take only what you need and leave the land as you found it." - Native American Proverb

        1 Reply Last reply
        0
        • G Gary R Wheeler

          Christof Schardt wrote:

          On PC this doesn't seem to be a serious topic

          The current generation of PC's and Windows has overall better performance when any 'extra' available RAM is left to the operating system. Windows uses a portion of free RAM as a disk cache (there's the RAM disk you wondered about). The advantage today is that the O/S manages it for you, and you don't have to worry about copying files back and forth. There are a number of things you can do to improve build performance. Make sure that any header files that don't change a lot are included in your precompiled headers. Break your projects into smaller pieces that are linked into the final application as object libraries (.LIB's), or even at runtime as DLL's. Your objective here is to reduce the amount of code that gets recompiled when you make changes, rather than to decrease the overall compile time itself. Most of the time, you are working on a small portion of the code, and don't need to recompile the whole thing.


          Software Zen: delete this;

          B Offline
          B Offline
          Blake Miller
          wrote on last edited by
          #4

          You can also try to use the #pragma once in your header fils so they are not parsed multiple times, even if included multiple times. I also find that keeping my HD defragmented helps a lot too. If you run a virus scanner with 'on access' scanning, disable the folders containing your source files. Disable some output options you might not use, such as class browser (I don't use it, speeds up build times since not making the BSC file for each project).

          C 1 Reply Last reply
          0
          • B Blake Miller

            You can also try to use the #pragma once in your header fils so they are not parsed multiple times, even if included multiple times. I also find that keeping my HD defragmented helps a lot too. If you run a virus scanner with 'on access' scanning, disable the folders containing your source files. Disable some output options you might not use, such as class browser (I don't use it, speeds up build times since not making the BSC file for each project).

            C Offline
            C Offline
            Christof Schardt
            wrote on last edited by
            #5

            Of course I have an include-guard in all my headers. BTW: Is there a difference between #pragma once ... // my code and #ifnded XY_INCLUDED #define XY_INCLUDED ... // my code #endif or is it just a MS-shorthand for this? Thanks anyway for your additional hints. Christof

            B 1 Reply Last reply
            0
            • C Christof Schardt

              Of course I have an include-guard in all my headers. BTW: Is there a difference between #pragma once ... // my code and #ifnded XY_INCLUDED #define XY_INCLUDED ... // my code #endif or is it just a MS-shorthand for this? Thanks anyway for your additional hints. Christof

              B Offline
              B Offline
              Blake Miller
              wrote on last edited by
              #6

              I do not know for certain. It is my suspicion that the #pragma once will cause the file to be added to a table that it has already been processed, whereas the #ifndef does not necessarily preclude reparsing of the entire header, as one does not necessarily include or preclude the entire file within the confines of an #ifndef/#endif set. The #pragma once, however, seems to imply, "hey, once you read this file for this compilation unit, don't bother reading it again". I favor adding the #pragma once if I now a header would never require reparsing within a single compilation unit. I prefer to create headers that do not depend upon such reparsing activity.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups