BlitzMax compilation speedup (Windows NT)

BlitzMax Forums/BlitzMax Tutorials/BlitzMax compilation speedup (Windows NT)

BlitzSupport(Posted 2009) [#1]
First of all, this has only been tested on XP; I don't know if it'll work on Vista or '7 -- this is entirely dependent on whether or not AR RAM Disk works with them, or you can find a similar program. It won't work on non-NT systems, eg. Windows 95/98/Me, unless you can find another RAM drive that works with them.

It's also perhaps a little advanced and does require a little effort, though you'll get an idea of the difference it can make by only following steps 1 and 2 below.


The benefits are:

1) much faster launching of MaxIDE (or your preferred IDE);
2) much faster building of projects;
3) much faster building of modules;
4) everything just feels so much quicker!


Anyway, I've only fiddled with running BlitzMax from RAM a little bit in the past, but if you install a RAM disk that can be assigned a normal drive letter, such as AR RAM Disk, and copy your BlitzMax folder into it, compilation receives a fairly dramatic speedup, as does simply launching the IDE. This makes Max much nicer to use if you're frequently re-building your project!

If you also copy MinGW to the RAM disk (and update the required environment variables), module compilation speeds up dramatically. Running "Rebuild all Modules" from the IDE goes from a yawn-inducing 4.7 minutes on my system to a mere 1.6 minutes.

I've spent some time today making this a more permanent setup. To try it for yourself:

1) Install AR RAM Disk from here.

After installation, the Settings dialog is displayed (which you can later access from the Control Panel). Make sure it's enabled, set the drive letter to whatever you want (I use Z:), set "Startup Type" to "Automatic" and "Operating Mode" to "Emulate a local hard disk". On the "Geometry" tab, set the required size in MB, bearing in mind that it needs this much free memory (real memory, not virtual!). BlitzMax stripped down a little should only need around 40 MB; MinGW needs about another 65 MB, though it's only really needed if you're compiling modules.

Reboot, and the RAM disk should hopefully appear in My Computer. You can access it like any other drive from there. (In fact, I put my system pagefile in there!) If it doesn't appear, you may need to set a lower size and reboot. (If your computer has, for example, 512 MB, and you set the RAM disk to use 256 MB, there may not be enough physical memory left once Windows has loaded for the RAM disk to work.)

2) Depending on the size of your RAM disk, you may want to copy the BlitzMax folder to another place on your hard drive and strip it down: you can safely delete the \samples folder, plus anything in \tmp (and maybe \docs if you don't need them). I also used UPX on all the exes (MaxIDE and the contents of \bin), though this is overkill really.

If you have a large enough RAM disk, you can just copy your existing BlitzMax folder into it. (I'd still recommend clearing out \tmp at least -- delete everything.)

[You can run BlitzMax from this point to see the difference, particularly on rebuilding modified projects, or if you have Quick Build turned off.]

3) For faster module compilation (and a slight boost to general compilation) you can also copy your existing MinGW folder to RAM and set the relevant environment variables as per Mark's post here. Set the "MINGW" variable to point to the new MinGW folder in the RAM disk (in my case, it's Z:\MinGW). If you have MinGW set up correctly, you'll also have a reference to MinGW's \bin folder in your PATH variable. I strongly recommend modifying this, replacing the absolute path (eg. "C:\MinGW\bin") with %MinGW%\bin (note % sign either side) -- this means that you only need to modify the MINGW variable if you want to change the location at any point.

Even just using this to rebuild all modules is worthwhile, time-wise -- once complete, you can just delete your 'proper' BlitzMax\mod folder (the one on the hard drive) and replace it with the newly-built mod folder from the RAM disk.

[Run BlitzMax and select "Rebuild all Modules" from the IDE's Program menu to see the improvement.]

4) You can gain a minor speedup by copying your project into the RAM disk, but obviously you run the risk of losing it if your system crashes. Doing this really doesn't make as much difference as having BlitzMax and MinGW in RAM, though. Perhaps on large projects with many IncBin'd resources it'd be worth doing, as long as you back up to the hard drive regularly.

I've written a little program that copies my customised BlitzMax folder (plus MinGW) into the RAM disk on startup, and another to launch it from the new location (copying Max/MinGW if they're not in RAM), and everything is just so much snappier! (I've set my MINGW variable to permanently point to the RAM folder. It doesn't matter if the MinGW folder hasn't been copied -- you can just do it when you want to build your modules.)


xlsior(Posted 2009) [#2]
From the website: It's been discontinued, and does not support vista and/or 64-bit windows.

Of course, if you're using this, you also need to make sure that you copy any changes back from the RAM drive to the harddrive when you're doing things like adding / recompiling modules...

(I my case, I'm sure that the BlitzMax folder is *way* too large for this to be of any use: Somehow there's 107.000 files, taking up 2GB. (This does NOT include any of my own sourcecode, that's stored elsewhere))
'just' making a copy to RAM would take forever.


Dreamora(Posted 2009) [#3]
I doubt that it can become significantly faster than it is on my box right now, as the main part of the compilation comes from process launching. My system takes something around 2 min to fully recompile pub, brl and maxgui + vertex + diablo + 2-3 other mod folders. And the mod folder that takes by far longest (and is the least usefull) is the maxgui fltk one which is totally worthless on Vista64 :)

So I would guess that the simpler solution is to get a 4 disk RAID5 system and a sweet little Core i7 Tri-Channel-RAM-Setup on Vista64. That setup also offers benefits in all the other situations outside of BM


ImaginaryHuman(Posted 2009) [#4]
Surely there are other ram disks out there?

I might look into this to see if there's some way to do it on a Mac.

Thanks James.