I went looking through base code and noticed that $(TMP_DIR) and $(TMPDIR) are both pointed to $(TOPDIR)/tmp. This writes temporary files to disk, since $(TOP_DIR) is the OpenWrt buildroot.
Is there a reason this isn't pointing to RAM? Is there a reason I shouldn't remove ./tmp as a directory and symlink it to /tmp?
Right, I saw the target and kernel temp files.. but, Would it be faster to use RAM for temp file stuff than even an SSD can offer? Even if it has to re-create the .kconfigxxxx and package index? Does OpenWrt not use $(TMP_DIR) for processing at all?
yes... it's mostly the io from build_dir/targ*/lin*/tmp @ image.mk where bin_dir is on the same disk...
( edit: technically if you enable ccache and also place that on ramdisk... you'll see quite a speed increase in subsequent builds, the rest of the stuff as mentioned is often used on subsequent builds to actually speed things up by not performing stuff that hasn't changed... )
I was facing a situation where I wanted to use $(TMP_DIR) for compat rather than trying to call /tmp for processing archival files but then realized all of the unnecessary IO calls made me stop and question it.
test with ccache... then test with ccache on ramdisk...
you can get some good stats with '-s';
sample-ccache-stats
# ccache -s
cache hit (direct) 47845
cache hit (preprocessed) 7209
cache miss 21268
cache hit rate 72.13 %
called for link 603
called for preprocessing 2890
compiler produced empty output 2241
preprocessor error 7850
unsupported code directive 559
no input file 10356
cleanups performed 0
files in cache 59147
cache size 2.0 GB
max cache size 15.0 GB
I actually don't use ccache either I ran into problems with ccache when I was building all the packages, and it's just been easier to forgo it.. I'll have to try it again. I do enough scratch compiles I can test it a variety of ways, I suppose.
@jow said ccache was disabled on the buildbots because it was more trouble than it was worth, but my issue was a limit issue with luci and CONFIG_ALL=y. I just never turned it back on once I stopped having to build everything out like that. I'll give it another shot.