|
From: <sv...@va...> - 2015-03-05 00:52:15
|
Author: sewardj
Date: Thu Mar 5 00:52:07 2015
New Revision: 14977
Log:
Minor changes in an attempt to improve performance and reduce
the amount of file-reading resulting from DiImage-cache misses.
CACHE_N_ENTRIES:
Increase the DiImage cache size from 256KB to 8MB to deal with
drastically worse locality when reading inline info. The 256KB
setting dates from befre inline-info-reading days.
is_in_CEnt: remove a conditional branch from the hot path (of |get|,
effectively)
set_CEnt: marginally improve debug printing
Modified:
trunk/coregrind/m_debuginfo/image.c
Modified: trunk/coregrind/m_debuginfo/image.c
==============================================================================
--- trunk/coregrind/m_debuginfo/image.c (original)
+++ trunk/coregrind/m_debuginfo/image.c Thu Mar 5 00:52:07 2015
@@ -46,8 +46,10 @@
#include "minilzo.h"
+/* These values (1024 entries of 8192 bytes each) gives a cache
+ size of 8MB. */
#define CACHE_ENTRY_SIZE_BITS (12+1)
-#define CACHE_N_ENTRIES 32
+#define CACHE_N_ENTRIES 1024
#define CACHE_ENTRY_SIZE (1 << CACHE_ENTRY_SIZE_BITS)
@@ -394,7 +396,17 @@
no benefit, whereas skipping it does remove it from the hottest
path. */
/* vg_assert(cent->used > 0 && cent->used <= CACHE_ENTRY_SIZE); */
- return cent->off <= off && off < cent->off + cent->used;
+ /* What we want to return is:
+ cent->off <= off && off < cent->off + cent->used;
+ This is however a very hot path, so here's alternative that uses
+ only one conditional branch, using the following transformation,
+ where all quantities are unsigned:
+ x >= LO && x < LO+N
+ --> x-LO >= 0 && x-LO < LO+N-LO
+ --> x-LO >= 0 && x-LO < N
+ --> x-LO < N
+ */
+ return off - cent->off < cent->used;
}
/* Allocate a new CEnt, connect it to |img|, and return its index. */
@@ -456,7 +468,7 @@
UInt delay = now - t_last;
t_last = now;
nread += len;
- VG_(printf)("XXXXXXXX (tot %lld) read %ld offset %lld %u\n",
+ VG_(printf)("XXXXXXXX (tot %'lld) read %'ld offset %'lld delay %'u\n",
nread, len, off, delay);
}
|