Skip to content

Commit

Permalink
Speed up least repeated txt search
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Jan 17, 2025
1 parent de504ee commit 43e0262
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sherpa-onnx/csrc/offline-tts-cache-mechanism.cc
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,11 @@ std::string CacheMechanism::GetLeastRepeatedFile() {
int32_t min_count = std::numeric_limits<int32_t>::max();

for (const auto &entry : repeat_counts_) {
if (entry.second == 1) {
least_repeated_file = entry.first;
return least_repeated_file;
}

if (entry.second < min_count) {
min_count = entry.second;
least_repeated_file = entry.first;
Expand Down

0 comments on commit 43e0262

Please sign in to comment.