diff options
author | Yorhel <git@yorhel.nl> | 2012-03-25 17:13:15 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2012-03-25 17:15:59 +0200 |
commit | 39060d51a65cafc99bd53a0fbc06e783e592a936 (patch) | |
tree | f536cefcca12123c2032cea233fff6b24a9b8301 | |
parent | db8ce7e1914259911d44c9ac22dc9bd84d5a96a1 (diff) |
Lowered minimum map size from 32 to 16 buckets
I'd expect small maps (<10 items) to be quite common, and 32 buckets is
a waste of memory in that case. It's not like growing the map takes that
much time at the small sizes anyway.
(This not-surprisingly changed the order of the object elements in a
json test)
-rw-r--r-- | tanja.c | 2 | ||||
-rw-r--r-- | test/json.c | 2 |
2 files changed, 2 insertions, 2 deletions
@@ -374,7 +374,7 @@ static inline void tn_map_grow(tn_el *m, int new) { return; int s = m->size; if(!s) - s = 32; + s = 16; while(s < ((m->count+new)*4)/3) s <<= 1; assert(s < UINT16_MAX); // Might want to handle this diff --git a/test/json.c b/test/json.c index 821f786..0306e5a 100644 --- a/test/json.c +++ b/test/json.c @@ -125,7 +125,7 @@ static void test_tuples() { t("[ { } ]", "[{}]"); t("[{\"\":true}]", "[{\"\":1}]"); e("[{\"a\":null,\"b\":\"str\"}]"); - t("[{\"1\" : \"1\" , \"\\t\" \t : {} } ]", "[{\"\\t\":{},\"1\":\"1\"}]"); // order depends on hash function + t("[{\"1\" : \"1\" , \"\\t\" \t : {} } ]", "[{\"1\":\"1\",\"\\t\":{}}]"); // order depends on hash function f("[{1:2}]", 2); f("[{\"1\"}]", 5); f("[{\"\":}]", 5); |