Skip to content

perf(actions): pre-normalize Command Palette fields and eliminate repeated lowercasing in schema search #1528

Open

Description

@ZhuchkaTriplesix

Problem

  1. In QueryaCommand.matches (lib/core/actions/querya_command.dart), for every registered command on every keystroke in the Command Palette, id.split('.').last.toLowerCase(), fields = <String>[...], and q.split(RegExp(r'\s+')) are executed. For 150 commands, this creates 150 regex compilations and hundreds of temporary lists and strings.
  2. In filterSchemaObjects (lib/core/actions/querya_schema_object.dart), for every keystroke, object.searchHaystack.toLowerCase() is called for all 5,000+ schema objects in memory, generating 5,000 heap strings per character typed.

Solution

  • Pre-normalize search haystacks to lowercase once when creating or registering QueryaCommand and QueryaSchemaObject.
  • Split query once before the loop rather than repeating inside every command's match check.
  • Replace id.split('.').last with index scanning from the end (lastIndexOf('.')).

Benefits

  • 0 lowercasing allocations inside the search loop (saving 5,000+ string allocations per keystroke).
  • Smooth 60/120 FPS filtering in Quick Open and Command Palette.

Activity

  1. added
    performanceTheme parser epic label: performance
    enhancementNew feature or request
    coreCore library logic and services
    uiUser interface components and widgets
    P2Medium priority / Parity & Refactoring
    on Oct 12, 2026
  2. added this to the 0.5.0 milestone on Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium priority / Parity & RefactoringcoreCore library logic and servicesenhancementNew feature or requestperformanceTheme parser epic label: performanceuiUser interface components and widgets

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions