Skip to content

SystemTools: GetRealPath - cache RealPath result

realpath is a real-world bottleneck in some use cases. however we can introduce a cache here to avoid excessive realpath calls.

in my real-world use case, it shaved off about 25% of the execution time when invoking cmake (from 7.7s to 5.6s)

execution time before:

tim@moka-mac:~/build/Debug$ time ~/dev/cmk/bin/cmake .
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/tim/build/Debug

real    0m7.678s
user    0m3.418s
sys 0m3.756s

execution time after:

tim@moka-mac:~/build/Debug$ time ~/dev/cmk/bin/cmake .
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/tim/build/Debug

real    0m5.648s
user    0m3.257s
sys 0m2.180s

Merge request reports