Hi *, nice to see ccache back active :-) - but I was shocked when I tried direct mode on Mac/PPC. For comparison:
real time for compiling OOo's binfilter module in preprocessor mode: 8:30 (8 Minutes, 30 Seconds), with filled cache real time for compiling OOo's binfilter module in direct mode: 35:50 (no typo thirty-five minutes compared to eight) While investigating this problem, I found the root cause: Using mmap to load all the include files bypasses the filesystem cache, and I/O performance on Mac isn't great to begin with… (On Mac Intel with RAID0, direct mode performed slightly better than preprocessor mode, thus you might only experience it on systems with pathetic I/O) Changing the corresponding code to use read instead solved this problem. Then direct mode is down to 4:10 - Yay! :-) But while browsing the code, two other questions came up: * is there any reason why you don't use calloc but use malloc + memset? * when using ccache 2.4, the patch to fix --ccache-skip was needed, at first glance that code did not change, so my guess is that it is still needed? http://www.mail-archive.com/ccache@lists.samba.org/msg00197.html (talking about this one) Also I noticed that ccache now reject everything remotely looking like a filelist, this is a little unfortunate since OOo uses -install_name @_(50 underscores)identifier/libraryname to later rewrite it to the target location and thus those compiles won't be cached - hashing install_name and its value should be OK.... ciao Christian
diff -ru ccache-3.0.1/hashutil.c ccache_mod/hashutil.c --- ccache-3.0.1/hashutil.c 2010-07-15 17:52:30.000000000 +0200 +++ ccache_mod/hashutil.c 2010-08-23 03:26:14.000000000 +0200 @@ -21,6 +21,7 @@ #include "murmurhashneutral2.h" #include <string.h> +#include <stdlib.h> #include <sys/mman.h> #include <fcntl.h> #include <time.h> @@ -218,14 +219,15 @@ close(fd); return HASH_SOURCE_CODE_OK; } - data = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0); - close(fd); - if (data == (void *)-1) { - cc_log("Failed to mmap %s", path); + data=malloc(st.st_size); + if (data == NULL || (read(fd, data, st.st_size) == -1) ) { + cc_log("Failed to read %s", path); + free(data); + close(fd); return HASH_SOURCE_CODE_ERROR; } - + close(fd); result = hash_source_code_string(hash, data, st.st_size, path); - munmap(data, st.st_size); + free(data); return result; }
_______________________________________________ ccache mailing list ccache@lists.samba.org https://lists.samba.org/mailman/listinfo/ccache