]> granicus.if.org Git - clang/commitdiff
Hack ReadFileFast() to raise the threshold of memory mapped files (from 4->12 pages).
authorSteve Naroff <snaroff@apple.com>
Mon, 31 Mar 2008 18:44:59 +0000 (18:44 +0000)
committerSteve Naroff <snaroff@apple.com>
Mon, 31 Mar 2008 18:44:59 +0000 (18:44 +0000)
This is a temporary solution to avoid running out of file descriptors (which defaults to 256).

Need to benchmark to understand the speed benefit. If the benefit is small, the simple solution is to avoid memory mapping files. If the benefit is significant, more thought is necessary.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48991 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/SourceManager.cpp

index 73ac2abe26f50bce40f3f879ad40d4b448d38d57..1141bed197db60532ac5a44a094630b62dba3bf6 100644 (file)
@@ -51,7 +51,7 @@ static const MemoryBuffer *ReadFileFast(const FileEntry *FileEnt) {
 #endif
   
   // If the file is larger than some threshold, use 'read', otherwise use mmap.
-  if (FileEnt->getSize() >= 4096*4)
+  if (FileEnt->getSize() >= 4096*12)
     return MemoryBuffer::getFile(FileEnt->getName(), strlen(FileEnt->getName()),
                                  0, FileEnt->getSize());