Skip to content

Commit

Permalink
fix suggestions performance (#1008)
Browse files Browse the repository at this point in the history
**Required**:

Task/Issue URL:
https://app.asana.com/0/1201048563534612/1208413716679959/f
iOS PR: duckduckgo/iOS#3405
macOS PR: duckduckgo/macos-browser#3353
What kind of version bump will this require?: Major/Minor/Patch

**Optional**:

Tech Design URL:
CC:

**Description**:
Fix suggestions performance issue by just looking at the first 100
sorted local results.

**Steps to test this PR**:
1. Run the app on a local large data source (history entries > 1000
entries ideally)
1. Use autocomplete and check that it doesn't time out for a broad range
of matches
  • Loading branch information
brindy authored Sep 27, 2024
1 parent 20469bb commit b60b38b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sources/Suggestions/SuggestionProcessing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ final class SuggestionProcessing {
}

// Get best matches from history and bookmarks
let allLocalSuggestions = localSuggestions(from: history, bookmarks: bookmarks, internalPages: internalPages, openTabs: openTabs, query: query)
let allLocalSuggestions = Array(localSuggestions(from: history, bookmarks: bookmarks, internalPages: internalPages, openTabs: openTabs, query: query)
.prefix(100)) // temporary optimsiation

// Combine HaB and domains into navigational suggestions and remove duplicates
let navigationalSuggestions = allLocalSuggestions + duckDuckGoDomainSuggestions
Expand Down

0 comments on commit b60b38b

Please sign in to comment.