From 5bebe31765e05803c42d561ad1ecaf3ce4128860 Mon Sep 17 00:00:00 2001 From: Mikkel Denker Date: Tue, 19 Mar 2024 16:21:02 +0100 Subject: [PATCH] refactor data that is re-used across fields for a particular page during indexing into an 'FnCache' --- Cargo.lock | 13 + Cargo.toml | 1 + assets/licenses.html | 3 +- crates/core/Cargo.toml | 1 + crates/core/src/mapreduce/dht/mod.rs | 8 +- crates/core/src/mapreduce/dht/network/mod.rs | 20 +- crates/core/src/mapreduce/dht/network/raft.rs | 28 +- crates/core/src/query/parser/mod.rs | 5 +- crates/core/src/webpage/html/fn_cache.rs | 136 +++++++ crates/core/src/webpage/html/into_tantivy.rs | 356 ++++++++++-------- crates/core/src/webpage/html/mod.rs | 1 + 11 files changed, 388 insertions(+), 184 deletions(-) create mode 100644 crates/core/src/webpage/html/fn_cache.rs diff --git a/Cargo.lock b/Cargo.lock index b22de01f..a844080c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1373,6 +1373,18 @@ dependencies = [ "syn 2.0.52", ] +[[package]] +name = "enum_dispatch" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f33313078bb8d4d05a2733a94ac4c2d8a0df9a2b84424ebf4f33bfc224a890e" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.52", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -4536,6 +4548,7 @@ dependencies = [ "csv", "dashmap", "encoding_rs", + "enum_dispatch", "eventsource-stream", "fend-core", "flate2", diff --git a/Cargo.toml b/Cargo.toml index f7c975af..a5209b61 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,6 +40,7 @@ crossbeam-channel = "0.5.6" csv = "1.1.6" dashmap = { version = "5.4.0", features = ["rayon"] } encoding_rs = "0.8.31" +enum_dispatch = "0.3.12" eventsource-stream = "0.2.3" fend-core = "1.2.2" flate2 = "1.0.28" diff --git a/assets/licenses.html b/assets/licenses.html index f9d0aa04..e51ee66c 100644 --- a/assets/licenses.html +++ b/assets/licenses.html @@ -44,7 +44,7 @@

Third Party Licenses

Overview of licenses: