You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(editor): eliminate two-way controller bouncing and full-string comparisons in QueryaCodeEditor #1352
In lib/core/editor/querya_code_editor.dart (lines 103–127, 181–185):
When an external controller is provided (e.g. from SqlQueryTabSession), QueryaCodeEditor instantiates an internal _highlightController (QueryaHighlightController) and wires up two-way listeners:
external.addListener(_syncFromExternal)
_highlightController.addListener(_syncToExternal)
Both callbacks perform full string comparisons:
if (external.text == highlight.text &&external.selection == highlight.selection) {
return;
}
Whenever the user types a single character:
_highlightController notifies listeners.
_syncToExternal runs and compares external.text == highlight.text (full string comparison of the entire document).
If unequal, external.value = highlight.value.
external notifies its listeners.
_syncFromExternal runs and compares external.text == highlight.text again.
In medium to large SQL scripts (e.g. 50–500 KB), typing a single character triggers repeated multi-kilobyte string comparisons on the main UI thread.
Proposed Solution
Allow QueryaCodeEditor to share the controller directly or allow SqlQueryTabSession to create a QueryaHighlightController directly.
If two-way sync is retained for plain external controllers, track version/revision tokens or listen directly without comparing entire document strings on every keystroke.
Acceptance Criteria
No full-document string equality checks (external.text == highlight.text) on every keystroke in QueryaCodeEditor.
Synchronization between SqlQueryTabSession.controller and the editor remains consistent without text loss or cursor jumping.
Resolved in #1467. Eliminated redundant text listener registration when onChanged is null and optimized _onTextChanged to use O(1) reference identity and length differential checks instead of repeated full-document string comparisons.
Activity
perf(editor): eliminate full-string comparisons and redundant listene…
ZhuchkaTriplesix commentedon Oct 11, 2026
Resolved in #1467. Eliminated redundant text listener registration when onChanged is null and optimized _onTextChanged to use O(1) reference identity and length differential checks instead of repeated full-document string comparisons.