Skip to content

perf(ui): flyweight Paint and zero-allocation line drawing in QueryaTreeIndentGuide #1526

Open

Description

@ZhuchkaTriplesix

Problem

In _QueryaTreeIndentGuidePainter.paint (lib/core/ui/querya_tree_indent_guide.dart), a new Paint() object is instantiated on every paint call, and canvas.drawLine(Offset(x, 0), Offset(x, size.height), paint) is invoked in a loop per depth level.
At 60 FPS during sidebar scroll (50 visible items * depth 3), this generates ~21,000 objects per second, causing GC pressure during scroll animations.

Solution

  • Use a reusable static/field Paint instance with updated color/strokeWidth.
  • Minimize Offset allocations (or cache point pairs where possible).

Benefits

  • Zero Paint object allocations during tree scrolling.
  • Smooth 60/120 FPS sidebar navigation even in deep database trees.

Activity

  1. added this to the 0.5.0 milestone on Oct 12, 2026
  2. added
    performanceTheme parser epic label: performance
    enhancementNew feature or request
    uiUser interface components and widgets
    connectionsDatabase connections, URI parsing, pools
    P2Medium priority / Parity & Refactoring
    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 & RefactoringconnectionsDatabase connections, URI parsing, poolsenhancementNew 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