diff options
author | antirez <antirez@gmail.com> | 2020-04-01 23:45:07 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2020-04-01 23:45:07 +0200 |
commit | 88e66ecf946f720db76b06dfb1a27834d16b7d61 (patch) | |
tree | 93d53264ec8618dbcbfb07751b0255777629d912 | |
parent | 8cdc15c3093a14f4a9af45cfae5679c67eda3fa0 (diff) | |
download | redis-88e66ecf946f720db76b06dfb1a27834d16b7d61.tar.gz |
LCS: 7x speedup by accessing the array with better locality.
-rw-r--r-- | src/t_string.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/t_string.c b/src/t_string.c index 0b159e6b3..b715e144a 100644 --- a/src/t_string.c +++ b/src/t_string.c @@ -551,7 +551,7 @@ void lcsCommand(client *c) { * LCS A0..i-1, B0..j-1. Note that we have a linear array here, so * we index it as LCS[i+alen*j] */ uint32_t *lcs = zmalloc((alen+1)*(blen+1)*sizeof(uint32_t)); - #define LCS(A,B) lcs[(A)+((B)*(alen+1))] + #define LCS(A,B) lcs[(B)+((A)*(blen+1))] /* Start building the LCS table. */ for (uint32_t i = 0; i <= alen; i++) { |