summaryrefslogtreecommitdiff
path: root/rts/Hpc.c
diff options
context:
space:
mode:
authorCrazycolorz5 <Crazycolorz5@gmail.com>2019-01-20 19:26:58 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-12-11 14:12:17 -0500
commitf80c4a66ae219afa7bd4172441f4e94ba649c9d9 (patch)
tree34c3aa2cc484ade9b2460ca18941763fcb101fcc /rts/Hpc.c
parent6e47a76a3d0a7b3d424442914478de579a49363c (diff)
downloadhaskell-f80c4a66ae219afa7bd4172441f4e94ba649c9d9.tar.gz
rts: Specialize hashing at call site rather than in struct.
Separate word and string hash tables on the type level, and do not store the hashing function. Thus when a different hash function is desire it is provided upon accessing the table. This is worst case the same as before the change, and in the majority of cases is better. Also mark the functions for aggressive inlining to improve performance. {F1686506} Reviewers: bgamari, erikd, simonmar Subscribers: rwbarton, thomie, carter GHC Trac Issues: #13165 Differential Revision: https://phabricator.haskell.org/D4889
Diffstat (limited to 'rts/Hpc.c')
-rw-r--r--rts/Hpc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/rts/Hpc.c b/rts/Hpc.c
index 52a833307f..37df56b6af 100644
--- a/rts/Hpc.c
+++ b/rts/Hpc.c
@@ -39,7 +39,7 @@ static pid_t hpc_pid = 0; // pid of this process at hpc-boot time.
static FILE *tixFile; // file being read/written
static int tix_ch; // current char
-static HashTable * moduleHash = NULL; // module name -> HpcModuleInfo
+static StrHashTable * moduleHash = NULL; // module name -> HpcModuleInfo
HpcModuleInfo *modules = 0;
@@ -152,11 +152,11 @@ readTix(void) {
expect(']');
ws();
- lookup = lookupHashTable(moduleHash, (StgWord)tmpModule->modName);
+ lookup = lookupStrHashTable(moduleHash, tmpModule->modName);
if (lookup == NULL) {
debugTrace(DEBUG_hpc,"readTix: new HpcModuleInfo for %s",
tmpModule->modName);
- insertHashTable(moduleHash, (StgWord)tmpModule->modName, tmpModule);
+ insertStrHashTable(moduleHash, tmpModule->modName, tmpModule);
} else {
ASSERT(lookup->tixArr != 0);
ASSERT(!strcmp(tmpModule->modName, lookup->modName));
@@ -265,7 +265,7 @@ hs_hpc_module(char *modName,
moduleHash = allocStrHashTable();
}
- tmpModule = lookupHashTable(moduleHash, (StgWord)modName);
+ tmpModule = lookupStrHashTable(moduleHash, modName);
if (tmpModule == NULL)
{
// Did not find entry so add one on.
@@ -282,7 +282,7 @@ hs_hpc_module(char *modName,
tmpModule->next = modules;
tmpModule->from_file = false;
modules = tmpModule;
- insertHashTable(moduleHash, (StgWord)modName, tmpModule);
+ insertStrHashTable(moduleHash, modName, tmpModule);
}
else
{
@@ -392,7 +392,7 @@ exitHpc(void) {
writeTix(f);
}
- freeHashTable(moduleHash, (void (*)(void *))freeHpcModuleInfo);
+ freeStrHashTable(moduleHash, (void (*)(void *))freeHpcModuleInfo);
moduleHash = NULL;
stgFree(tixFilename);