aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorVitaly Lavrov <vel21ripn@gmail.com>2021-06-23 10:03:52 +0000
committerGitHub <noreply@github.com>2021-06-23 12:03:52 +0200
commit35fc6a6de5ab1be3cc4c3c1eb9428b2312a503d0 (patch)
tree513b073307c4bd44bb2e211be2eaf82c730544be /src/include
parentf19937c8c9fd4e1c21988f523d9e78b954f6fcc8 (diff)
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%).
Diffstat (limited to 'src/include')
-rw-r--r--src/include/ndpi_api.h.in4
-rw-r--r--src/include/ndpi_typedefs.h1
2 files changed, 1 insertions, 4 deletions
diff --git a/src/include/ndpi_api.h.in b/src/include/ndpi_api.h.in
index 87e03f7e9..f62b4aa3c 100644
--- a/src/include/ndpi_api.h.in
+++ b/src/include/ndpi_api.h.in
@@ -499,9 +499,7 @@ extern "C" {
* @return 0
*
*/
- int ndpi_match_bigram(struct ndpi_detection_module_struct *ndpi_mod,
- ndpi_automa *automa,
- char *bigram_to_match);
+ int ndpi_match_bigram(const char *bigram_to_match);
/**
* Write the protocol name in the buffer -buf- as master_protocol.protocol
diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h
index 173f3baff..375739573 100644
--- a/src/include/ndpi_typedefs.h
+++ b/src/include/ndpi_typedefs.h
@@ -1153,7 +1153,6 @@ struct ndpi_detection_module_struct {
ndpi_automa host_automa, /* Used for DNS/HTTPS */
content_automa, /* Used for HTTP subprotocol_detection */
subprotocol_automa, /* Used for HTTP subprotocol_detection */
- bigrams_automa, trigrams_automa, impossible_bigrams_automa, /* TOR */
risky_domain_automa, tls_cert_subject_automa,
malicious_ja3_automa, malicious_sha1_automa;
/* IMPORTANT: please update ndpi_finalize_initialization() whenever you add a new automa */