Search code examples
delphirad-studioramdisk

Change RAD studio 10.2 Tokyo build path for Ram disk


For the reasons of the advantages of using the RAM Disk which is placed in the RAM memory instead of the HDD hard drives and SDD hard drives, we want as much as possible, created temporary files by RAD Studio, the files that the compiler/builder created during compile/build time, as well as the output files such as executable files, are created in the RAM disk drive.

Is it possible to change different build paths for projects in RAD Studio 10.2 Tokyo? How?

For example, instead of using drive C, use drive M which is a 4GB RAM disk.

Note that the project itself is inside C, but temporary files are moved somewhere else.

Benefits of using RAM disk:(reasons that is tempting me to do this)

  • faster build times (no real IO)

  • SSD wears out with repetitive rebuilds.

  • projects are inherently cleaned up (which brings following benefits)

  • share faster, your projects are not filled with unnecessary files so that you can easily share folders with others. (code size is usually less than 1MB but build objects can go beyond 100MB)

  • less chance of creating locked files. (which cause build desync, errors etc), in that case formatting ramdisk is easier than mucking with RAD Studio settings or restarting it.

Drawbacks:

  • you need much more RAM, in my case I have 28GB which I can spare 4GB for it.

  • if you reset RAD Studio or computer you loose compiled objects and you have to rebuild (once)

But benefits of using RAM disk clearly overweight its drawbacks.

Okay, now that I convinced you reasonably why I want this, give me paths.

How can export configuration options into a file for restoring initial configuration options?


Solution

  • You can change the desired paths in Project > Options > Building > Delphi Compiler.

    More specifically you will probably want to change

    • Package output directory:Specifies where the compiler puts generated package files.
    • Unit output directory: Specifies a separate directory to contain the compiled units (.dcu)
    • DCP output directory: You may want to override this value ifyour project heavily relies on packages. If left blank the global value is used. The global value can be changed in Tools > Options > Language > Delphi Options > Library

    Any way I don't think you will gain much by using RAM disk with Delphi. Why?

    Unlike many other programming languages that go and recompile every unit on each compilation Delphi recompiles only those units whose code has actually changed since last compilation (unless you specifically chose to Build entire project). So generally there are not many rewrites of compiled files like (.dcu)

    You may gain some performance during linking time since Liker will be able to retrieve those compiled files from RAM drive a lot faster than from a regular drive. Well some modern SSD drives can retrieve cached files (they keep last few accessed files in their internal cache) very fast so there may not be a lot of performance gain there either.


    As for SSD wear out.

    The number of rewrites that you will cause with Delhi even if you go and full build your project every time is nothing to what what Windows is doing by storing all the file index information that it gathers by constantly indexing file contents. And yes I have seen Windows deep indexing contents of .pas files so every time you save your project Windows will reindex your files. That is unless you have disabled deep indexing of *.pas files as i do.

    Oh and don't get me started on how much data windows writes by gathering and then processing all the telemetry data it constantly monitors.

    If you ever had a chance to see Windows 10 or newer running on a computer with mechanical HDD you would know that I mean. My mom has one such computer and I'm actually surprised that her HDD stil works without a problem since it is grinding (reading/writing) pretty much all the time.