Skip to content

Comments

Mobile: Improve inline search performance in large documents#13259

Merged
laurent22 merged 2 commits intolaurent22:devfrom
personalizedrefrigerator:pr/mobile/editor/improve-search-perf
Sep 30, 2025
Merged

Mobile: Improve inline search performance in large documents#13259
laurent22 merged 2 commits intolaurent22:devfrom
personalizedrefrigerator:pr/mobile/editor/improve-search-perf

Conversation

@personalizedrefrigerator
Copy link
Collaborator

@personalizedrefrigerator personalizedrefrigerator commented Sep 19, 2025

Summary

This change improves search performance in large documents by fixing two issues:

  1. Fixes an unnecessary state recomputation. Updating the search caused the initial injectedJavaScript to be recomputed. This involved serializing a JSON object that includes the initial editor text. The changes to the injectedJavaScript object then caused other state to update.
  2. Fixes an issue with syncing state to the WebView: If 1) the user was typing quickly and 2) IPC to/from the note editor was slow, the search query could reset to older values while typing.

Testing plan

iOS 18.4 simulator, Web:

  1. Create a very large note (~100,000 lines).
  2. Open the search panel.
  3. Search for text known to be present in the note.
  4. Press enter and verify that the editor scrolls to one of the matches.
  5. Quickly type in the search query box such that the search query is a long string.
  6. Verify that the search query updates without briefly reverting to older values.
  7. Close and re-open the note.
  8. Verify that the editor loads and that the note content is visible.

Web (regression testing):

  1. Open a small existing note in the Rich Text editor.
  2. Verify that it's possible to 1) open the search bar and 2) search for text known to be in the document.

This change improves search performance in large documents by fixing
two issues:
1. Updating the search caused the initial injectedJavaScript to be
   recomputed. This involves serializing a JSON object that includes
   the initial editor text.
2. If IPC to/from the note editor was slow, the search query could reset
   to older values when a new search query is typed quickly.
@personalizedrefrigerator personalizedrefrigerator added mobile All mobile platforms editor labels Sep 19, 2025
personalizedrefrigerator added a commit to personalizedrefrigerator/joplin that referenced this pull request Sep 22, 2025
personalizedrefrigerator added a commit to personalizedrefrigerator/joplin that referenced this pull request Sep 23, 2025
@laurent22 laurent22 merged commit f832eb3 into laurent22:dev Sep 30, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

editor mobile All mobile platforms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants