Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
88e66ecf
Commit
88e66ecf
authored
Apr 01, 2020
by
antirez
Browse files
LCS: 7x speedup by accessing the array with better locality.
parent
8cdc15c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/t_string.c
View file @
88e66ecf
...
...
@@ -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
)*(
a
len+1))]
#define LCS(A,B) lcs[(
B
)+((
A
)*(
b
len+1))]
/* Start building the LCS table. */
for
(
uint32_t
i
=
0
;
i
<=
alen
;
i
++
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment