-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimisation of history entry saving #675
Conversation
…amed to achieve consistency.
} | ||
} | ||
|
||
func markFailedToLoadUrl(_ url: URL) { | ||
mark(url: url, keyPath: \HistoryEntry.failedToLoad, value: true) | ||
} | ||
|
||
func commitChanges(url: URL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point of the optimisation to commit (save) once when we no longer expect changes related to the url. It means, user navigated to other url or closed the tab
@@ -318,14 +327,20 @@ final class HistoryCoordinator: HistoryCoordinating { | |||
} | |||
|
|||
private func makeHistoryDictionary(from history: History) -> [URL: HistoryEntry] { | |||
history.reduce(into: [URL: HistoryEntry](), { $0[$1.url] = $1 }) | |||
dispatchPrecondition(condition: .onQueue(queue)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to see more dispatchPrecondition
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, Instruments is much quieter now, this is a solid change. 👍
Thank you Sam! :) |
* develop: Bookmarks phase 2 bug fixes (#686) Attempt to stop the new tab button from jumping around the UI (#685) Fix of threading issues related to history causing crashes (#688) Add empty autofill isEnabled checks (to update BSK) (#683) Bump BSK to a version that uses updated GRDB (#647) Fix Save Credentials popover on macOS Ventura (#672) Update BSK to latest version + noop updates (#669) Update selectedTabViewModel only when it actually changes (#681) Update BSK to version 21.0.0 (#680) Always add the Autoconsent script (#666) Optimisation of history entry saving (#675)
# By Sam Symons (14) and others # Via GitHub (1) and others * develop: (45 commits) Revert "Prevent the app from quitting while the Fire button is active" (#690) Disable link preview. (#691) Fire Button quick wins (#677) Bookmarks phase 2 bug fixes (#686) Set version to 0.28.3. Only clear the selection if the selection needs to change. (#689) Set version to 0.28.2. Update embedded files for 0.28.2. Attempt to stop the new tab button from jumping around the UI (#685) Fix of threading issues related to history causing crashes (#688) Add empty autofill isEnabled checks (to update BSK) (#683) Bump BSK to a version that uses updated GRDB (#647) Fix Save Credentials popover on macOS Ventura (#672) Update BSK to latest version + noop updates (#669) Update selectedTabViewModel only when it actually changes (#681) Update BSK to version 21.0.0 (#680) Always add the Autoconsent script (#666) Optimisation of history entry saving (#675) Use localized compare to sort autofill items (#674) 0.28.1 ... # Conflicts: # DuckDuckGo.xcodeproj/project.pbxproj
Task/Issue URL: https://app.asana.com/0/1177771139624306/1202660511799171/f
Description:
This PR refactors saving of history URLs. The original implementation saves data to the Core Data store on every change and makes too many requests on sites with trackers.
After this change, Core Data Saves on cnn.com are reduced from almost 100 calls to 5. Those remaining 5 aren't related to history.
Steps to test this PR:
Testing checklist:
Internal references:
Software Engineering Expectations
Technical Design Template
When ready for review, remember to post the PR in MM