From 35fc6a6de5ab1be3cc4c3c1eb9428b2312a503d0 Mon Sep 17 00:00:00 2001 From: Vitaly Lavrov Date: Wed, 23 Jun 2021 10:03:52 +0000 Subject: Speed and memory size optimisation (#1214) Removed bigram_automata, impossible_bigram_automata, trigram_automata. The ahocorasick structure is replaced with a bitmap. The bitmap size for ndpi_en_bigram is 176 bytes. The bitmap size for ndpi_en_trigram is 2201 bytes. On the test machine, the test execution time was reduced from 27.3 seconds to 24.7 (9%). --- src/lib/ndpi_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib/ndpi_utils.c') diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c index f651ddd64..dddec3299 100644 --- a/src/lib/ndpi_utils.c +++ b/src/lib/ndpi_utils.c @@ -766,7 +766,7 @@ static int ndpi_find_non_eng_bigrams(struct ndpi_detection_module_struct *ndpi_s s[0] = tolower(str[0]), s[1] = tolower(str[1]), s[2] = '\0'; - return(ndpi_match_bigram(ndpi_struct, &ndpi_struct->bigrams_automa, s)); + return(ndpi_match_bigram(s)); } /* ******************************************************************** */ -- cgit v1.2.3