aboutsummaryrefslogtreecommitdiff
path: root/src/lj_tab.c
diff options
context:
space:
mode:
authorMike Pall <mike>2020-06-23 03:06:45 +0200
committerMike Pall <mike>2020-06-23 03:06:45 +0200
commitff34b48ddd6f2b3bdd26d6088662a214ba6b0288 (patch)
tree5585ab1933d148b046061a1e061686aa09e63789 /src/lj_tab.c
parenta44f53acf53603e7d9b88352de035b1804be4e88 (diff)
downloadluajit-ff34b48ddd6f2b3bdd26d6088662a214ba6b0288.tar.gz
luajit-ff34b48ddd6f2b3bdd26d6088662a214ba6b0288.tar.bz2
luajit-ff34b48ddd6f2b3bdd26d6088662a214ba6b0288.zip
Redesign and harden string interning.
Up to 40% faster on hash-intensive benchmarks. With some ideas from Sokolov Yura.
Diffstat (limited to 'src/lj_tab.c')
-rw-r--r--src/lj_tab.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lj_tab.c b/src/lj_tab.c
index efc423cb..982b0763 100644
--- a/src/lj_tab.c
+++ b/src/lj_tab.c
@@ -23,8 +23,8 @@ static LJ_AINLINE Node *hashmask(const GCtab *t, uint32_t hash)
23 return &n[hash & t->hmask]; 23 return &n[hash & t->hmask];
24} 24}
25 25
26/* String hashes are precomputed when they are interned. */ 26/* String IDs are generated when a string is interned. */
27#define hashstr(t, s) hashmask(t, (s)->hash) 27#define hashstr(t, s) hashmask(t, (s)->sid)
28 28
29#define hashlohi(t, lo, hi) hashmask((t), hashrot((lo), (hi))) 29#define hashlohi(t, lo, hi) hashmask((t), hashrot((lo), (hi)))
30#define hashnum(t, o) hashlohi((t), (o)->u32.lo, ((o)->u32.hi << 1)) 30#define hashnum(t, o) hashlohi((t), (o)->u32.lo, ((o)->u32.hi << 1))