From 8996fe03dc7dfc56c61278fc0ad34a8a2324493d Mon Sep 17 00:00:00 2001 From: Anton Blanchard Date: Fri, 15 Jan 2021 18:24:34 -0700 Subject: [PATCH] Increase OBJHASHSIZE I have a design that is taking quite a long time for netgen to complete LVS checking. Profiles show a large chunk of runtime is in the hash functions. Some of the hashtables are very sparsely populated, but others are heavily used. One hashtable has chains of over 250. Longer term it would be worth investigating resizing the hashtables (or perhaps using other data strutures), but for now I looked at what changing the number of hash buckets (OBJHASHSIZE) does for performance: OBJHASHSIZE time (mm:ss) 997 24:18 10093 4:42 42073 3:12 104729 2:51 I somewhat arbitrarily chose 42073 which gives us a 7.6x improvement in runtime. --- base/objlist.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/base/objlist.h b/base/objlist.h index 1ab920e..8bcd64c 100644 --- a/base/objlist.h +++ b/base/objlist.h @@ -192,9 +192,8 @@ struct Permutation { struct Permutation *next; }; -#define OBJHASHSIZE 997 /* the size of the object and instance hash lists */ +#define OBJHASHSIZE 42073 /* the size of the object and instance hash lists */ /* prime numbers are good choices as hash sizes */ - /* 101 is a good number for IBMPC */ /* cell definition for hash table */ /* NOTE: "file" must come first for the hash matching by name and file */