From 184ba229f1953780e5e8b278e2adecc83d220228 Mon Sep 17 00:00:00 2001 From: ptzz Date: Fri, 8 Dec 2017 10:51:02 +0100 Subject: [PATCH] Speed up matcher Speed up matching by ~30% by removing unnecessary call to strlen(). Before: 2 0.225716 0.000183 matcher#cmatch() After: 2 0.163005 0.000214 matcher#cmatch() --- autoload/fuzzycomt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/fuzzycomt.c b/autoload/fuzzycomt.c index ec48124..91c007c 100644 --- a/autoload/fuzzycomt.c +++ b/autoload/fuzzycomt.c @@ -364,7 +364,7 @@ matchobj_t ctrlp_find_match(PyObject* str, PyObject* abbrev, char *mmode) temp_string = strduplicate(PyString_AsString(str)); // Replace all backslashes - for (i = 0; i < strlen(temp_string); i++) { + for (i = 0; temp_string[i]; i++) { if (temp_string[i] == '\\') { temp_string[i] = '/'; }