set MAP_NOCACHE if we can
Set the MAP_NOCACHE flags in mmap() if we can. On OS X this stops the mad super-aggressive disc caching and produces a huge improveemnt in performance.
This commit is contained in:
parent
aca238dfca
commit
729b680841
@ -28,6 +28,8 @@
|
|||||||
- move im_stretch3() to deprecated
|
- move im_stretch3() to deprecated
|
||||||
- move im_clamp() to deprecated
|
- move im_clamp() to deprecated
|
||||||
- gtk-doc for video ... all operators done! amazing argh
|
- gtk-doc for video ... all operators done! amazing argh
|
||||||
|
- set MAP_NOCACHE on OS X, otherwise performance dives off a cliff with
|
||||||
|
files larger than memory
|
||||||
|
|
||||||
30/11/10 started 7.24.0
|
30/11/10 started 7.24.0
|
||||||
- bump for new stable
|
- bump for new stable
|
||||||
|
5
TODO
5
TODO
@ -1,7 +1,8 @@
|
|||||||
|
|
||||||
- does OS X have any mmap flags which could stop their crazy caching?
|
- use g_mmap() or whatever it's called ... or perhaps they don't have all
|
||||||
|
these options
|
||||||
|
|
||||||
|
|
||||||
- use g_mmap() or whatever it's called
|
|
||||||
|
|
||||||
|
|
||||||
- use |_O_TEMPORARY to open()'s mode on Windows for tmpfiles to increase the
|
- use |_O_TEMPORARY to open()'s mode on Windows for tmpfiles to increase the
|
||||||
|
@ -163,12 +163,23 @@ im__mmap( int fd, int writeable, size_t length, gint64 offset )
|
|||||||
#else /*!OS_WIN32*/
|
#else /*!OS_WIN32*/
|
||||||
{
|
{
|
||||||
int prot;
|
int prot;
|
||||||
|
int flags;
|
||||||
|
|
||||||
if( writeable )
|
if( writeable )
|
||||||
prot = PROT_WRITE;
|
prot = PROT_WRITE;
|
||||||
else
|
else
|
||||||
prot = PROT_READ;
|
prot = PROT_READ;
|
||||||
|
|
||||||
|
flags = MAP_SHARED;
|
||||||
|
|
||||||
|
/* OS X caches mmapped files very aggressively if this flags is not
|
||||||
|
* set. Scanning a large file without this flag will cause every other
|
||||||
|
* process to get swapped out and kill performance.
|
||||||
|
*/
|
||||||
|
#ifdef MAP_NOCACHE
|
||||||
|
flags |= MAP_NOCACHE;
|
||||||
|
#endif /*MAP_NOCACHE*/
|
||||||
|
|
||||||
/* Casting gint64 to off_t should be safe, even on *nixes without
|
/* Casting gint64 to off_t should be safe, even on *nixes without
|
||||||
* LARGEFILE.
|
* LARGEFILE.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user