RAM disk for compiling sketches

Wouldn’t it be much faster if the compiler could use a RAMdisk to do the stuff compilers do ?

If YES : how ???

1000 x thanks for every reply ! :slight_smile:

The newer IDE's have had the agressive cache feature for a while now.
SO not sure what you are really trying to say unless you have some very old hardware.

ballscrewbob:
The newer IDE's have had the agressive cache feature for a while now.
SO not sure what you are really trying to say unless you have some very old hardware.

My hardware is not brandnew, but I guess that an AMD 8core with 32G of Ram is "new enough" ... :slight_smile:
I see when the compiler is running, it uses to the C drive to put temporary files etc. My C drive is SSD, but a RAM disk is soooo muich faster than an SSD. Also the C drive is constantly in use by windows. If you're compiling a 50-line program, it's no use to use a ram disk to compile. But if we're talking about a sketch of a few thousand lines, it might save quite some time ...
So : how to direct the compiler to my RAM disk instead of to my C drive ???

Thanks !

A little beyond me but you could try the CLI version of the IDE

AFAIK its still in ALPHA but should allow you to direct to your ram disk.

There is also a thread for SLOW compile times that may also be worth looking at as there may be some further hints to increase speed there.

My hardware is less than yours but I dont really have any issues with speed even on larger compiles and I too use SSD as a primary drive with a SPLIT install.

Looking at the preferences file, I don't see any entry to set the location of the build folders used while compiling. So there may not be a way to do this...

Usually compile times slow enough to care about are due to other problems, most often an antivirus program set to do realtime scanning scanning each file created during the compile process.

PaulVdB:
Wouldn't it be much faster if the compiler could use a RAMdisk to do the stuff compilers do ?

Not with a modern operating system / file system.

There used to be a preference for build directory location...
I’ll see if I can hunt it down...

Thanks westf !

What do you mean with "modern OS/filesystem" ?
Do "modern" OS/file systems read and write with the same speed on Ram disk and SSD ?

ANyhow : thanks for your reply !

PaulVdB:
Do "modern" OS/file systems read and write with the same speed on Ram disk and SSD ?

Yes. Write-behind cache is the key-phrase. Using a RAMdisk just steals memory from the operating system.

OK. but then : why is there a HUGE difference in “compiling-time” betwwen my PC (C: = SSD) and my laptop (C: = HD) ?
Shouldn’t there be about the same difference between SD and RAM ?
Because I have 32 GB RAM installed, a RAMdisk of 10GB is always installed at boot. So “stealing” RAM isn’t an issue. I use this RAMdisk for all (possible) .temp files and the like…(saves A LOT of time !)
But I begin to believe that the Arduino IDE just can’t work with another disk than C: …

Nevertheless : my question stays … :slight_smile: and thanks for your reply.

westfw:
There used to be a preference for build directory location…
I’ll see if I can hunt it down…

build.path=/tmp/ArduBuild/

See: https://github.com/arduino/Arduino/blob/master/arduino-core/src/processing/app/Sketch.java#L169

I remember this having “quirks”, the last time I used it. Something about needing the directory to exist beforehand, and then deleting it when you exited. But the current comments imply that that’s all fixed now (Cool.)

PS: I was also under the impression that RAMDisks were pretty useless these days; most OSes do a lot of disk caching automatically, if there is spare memory. How do you even create a RAMDisk?

Thanks for your search westf !
As I see, it's not easy and maybe even not worth the hassle... Arduino does not like to work with RAMdisks...
As reply to your question how to get a ramdisk : there's several ways to do it. Just google "ramdisk" and many programs will show up.

I'd be interesting in any actual measurements you do...
Like I said, the preference seems to be mostly fixed.

westfw:
I’d be interesting in any actual measurements you do…
Like I said, the preference seems to be mostly fixed.

Sorry to answer so late.
Here’s pics from CrystalDiskMark :





the fast one is the RAMdisk, of course ! :slight_smile:
the slow one is a Samsung SSD 840 Series ATA…

Moderator edit: images inlined because STACK is trash

Using external hosting for images is, generally, a bad idea. Your images are not included now included in your post because a moderator thoughtfully corrected your mistake.

Sorry Moderator, I thought this was the ONLY way.
But thanks for correcting my error !

Well sure. But I'd expect a disk benchmark to go out of its way to bypass any pass caching. The question is whether it will improve the performance of an application that is a heavy disk user, like the Arduino build process.

Did you see significant improvement in actual build times?