From 3c09922d2937710f9190b19c1f6bb11c758085cf Mon Sep 17 00:00:00 2001 From: Martin Martinez Rivera Date: Sun, 17 Sep 2023 23:28:19 -0700 Subject: [PATCH] Improve performance due to slow indexing (#273) Newer versions of tantivy require more memory during the indexing phase. Otherwise the indexing phase will be a lot slower than in previous versions. See https://github.com/quickwit-oss/tantivy/issues/2156 for details. --- src/course_library.rs | 4 ++-- src/scheduler.rs | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/course_library.rs b/src/course_library.rs index 8685609..e69839c 100644 --- a/src/course_library.rs +++ b/src/course_library.rs @@ -550,8 +550,8 @@ impl LocalCourseLibrary { reader: None, }; - // Initialize the search index writer with an initial arena size of 50 MB. - let mut index_writer = library.index.writer(50_000_000)?; + // Initialize the search index writer with an initial arena size of 150 MB. + let mut index_writer = library.index.writer(150_000_000)?; // Convert the list of paths to ignore into absolute paths. let absolute_root = library_root.canonicalize()?; diff --git a/src/scheduler.rs b/src/scheduler.rs index 2abe4f1..bc1552f 100644 --- a/src/scheduler.rs +++ b/src/scheduler.rs @@ -746,11 +746,15 @@ impl DepthFirstScheduler { if let Some(superseded_by) = superseded_by { all_superseded_by.extend(superseded_by); } + let superseded_by = self.data.get_superseded_by(&candidate.course_id); if let Some(superseded_by) = superseded_by { all_superseded_by.extend(superseded_by); } } + if all_superseded_by.is_empty() { + return candidates; + } // Filter out the superseding lessons and courses with scores lower than the superseding // score.