[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 02/02: Bump fluid cache size to 16 entries
From: |
Andy Wingo |
Subject: |
[Guile-commits] 02/02: Bump fluid cache size to 16 entries |
Date: |
Fri, 17 Feb 2017 05:04:37 -0500 (EST) |
wingo pushed a commit to branch master
in repository guile.
commit 2864f11d3415c650d9e80f8e7787e4df81dcc7e9
Author: Andy Wingo <address@hidden>
Date: Fri Feb 17 11:01:19 2017 +0100
Bump fluid cache size to 16 entries
* libguile/cache-internal.h (SCM_CACHE_SIZE): Bump to 16. It seems that
a thread accesses more than 8 fluids by default (%stacks, the
exception handler, current ports, current-fiber, port read/write
waiters) which leads every fiber to cause cache eviction and copying
the value table, which is a bottleneck. Instead just bump this cache
size.
(scm_cache_lookup): Update unrolled search.
---
libguile/cache-internal.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libguile/cache-internal.h b/libguile/cache-internal.h
index fc1e3c1..4c1732f 100644
--- a/libguile/cache-internal.h
+++ b/libguile/cache-internal.h
@@ -39,7 +39,7 @@ struct scm_cache_entry
scm_t_bits value;
};
-#define SCM_CACHE_SIZE 8
+#define SCM_CACHE_SIZE 16
struct scm_cache
{
@@ -81,6 +81,7 @@ scm_cache_lookup (struct scm_cache *cache, SCM k)
scm_t_bits k_bits = SCM_UNPACK (k);
struct scm_cache_entry *entry = cache->entries;
/* Unrolled binary search, compiled to branchless cmp + cmov chain. */
+ if (entry[8].key <= k_bits) entry += 8;
if (entry[4].key <= k_bits) entry += 4;
if (entry[2].key <= k_bits) entry += 2;
if (entry[1].key <= k_bits) entry += 1;