Skip to content

Searching causes sluggishness #11

@Zin-i

Description

@Zin-i

Whilst using the search feature, I noticed that it can cause sluggishness in the typing of the text, as seen in this video.

2026-04-06.16-53-33.mp4

This can easily be fixed by adding a debounce to the search, so that a search isn't activated every single time a new character has been entered. I demonstrated this process by adding my own via the browser console (code & video shown below).

const input = document.getElementById('syntax-search-input');
const newInput = input.cloneNode(true);
input.parentNode.replaceChild(newInput, input);
const r = window.__syntaxDisplayManager;
let timer;
newInput.addEventListener('input', () => {
  clearTimeout(timer);
  timer = setTimeout(() => {
    r.updateSearchQuery(newInput.value);
  }, 15);
});
2026-04-06.17-07-05.mp4

Whilst the debounce is minimal, it improves performance significantly; although, I would not recommend using a predefined debounce time as the debounce time required to combat the jitter varies between devices (throttling my cpu 4x makes this debounce effectively useless).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions