summaryrefslogtreecommitdiff
path: root/src/journal/mmap-cache.h
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-12-03 18:25:44 +0100
committerMichal Schmidt <mschmidt@redhat.com>2014-12-13 00:47:23 +0100
commit69adae5168da231c6cf319f708860954701b25ed (patch)
treea682223e1a24f70b2befef8d678a545b0746a889 /src/journal/mmap-cache.h
parent634ed0ee3466e5e5f78d3acbe9782650ff456288 (diff)
journal: replace contexts hashmap with a plain array
try_context() is such a hot path that the hashmap lookup is expensive. The number of contexts is small - it is the number of object types. Using a hashmap is overkill. A plain array will do. Before: $ time ./journalctl --since=2014-06-01 --until=2014-07-01 > /dev/null real 0m9.445s user 0m9.228s sys 0m0.213s After: $ time ./journalctl --since=2014-06-01 --until=2014-07-01 > /dev/null real 0m5.438s user 0m5.266s sys 0m0.170s
Diffstat (limited to 'src/journal/mmap-cache.h')
-rw-r--r--src/journal/mmap-cache.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/journal/mmap-cache.h b/src/journal/mmap-cache.h
index 543a2bf2d0..fe2c83d751 100644
--- a/src/journal/mmap-cache.h
+++ b/src/journal/mmap-cache.h
@@ -25,6 +25,8 @@
#include <stdbool.h>
#include <sys/stat.h>
+#define MMAP_CACHE_MAX_CONTEXTS 8
+
typedef struct MMapCache MMapCache;
MMapCache* mmap_cache_new(void);