version: refine version calculation
version: refine version calculation

This commit refines the existing version calculation. It tries to minimize the number of calls to get_hash_of_directories because this call is very expensive on slow disks (NFS mounts).
There are many more situations where we do not need to rely on the has calculation because it might have already been done once (.hash files).

Former-commit-id: 58311010a02ee8fc9c5f8c3555ebf0a1c2e96868
Former-commit-id: 664c939f649ec86971fc172d2fed3f34f7ef7956 [formerly d339de133fd118bcd07d6e3617c436b795210cc4] [formerly 5c124758230a7535a67503f64f5d3561b0934e22 [formerly 8e0f25f77f5273ea88fc9b69abc965ed4fd964c7]]
Former-commit-id: 03fb479a615bbedf0474137ed2cfd1ed406c2930 [formerly 37099d99d11a0705716a5419ef6a602fea436a0c]
Former-commit-id: 846f1f607200a5d9df1ee217955a4586d04aeb2a
PolyJIT/benchbuild,PolyJIT/benchbuild,PolyJIT/benchbuild,PolyJIT/benchbuild