dataTable/TEST.md

2.4 KiB

DataTable Performance Tracking

v1: Minimal Foundation

  • Data: 10,000 items, 1 column.
  • Scroll Test: 100 scrolls (20,000px total).
  • Results:
    • refreshCount: 101
    • refreshTime (total): ~45.7ms
    • averageRefreshTime: 0.45ms
    • totalNodes: 3030 (avg 30/frame)
  • Notes: Silk smooth, base VirtualScroll works perfectly.

v4: Optimized Responsiveness (Immediate Refresh)

  • Data: 10,000 items, 10 columns.
  • Scroll Test: 100 scrolls (20,000px total).
  • Results:
    • refreshCount: 101
    • refreshTime (total): ~101.2ms
    • averageRefreshTime: 1.01ms
    • totalNodes: 3030
  • Notes: Removed .dt-body wrapper to simplify DOM depth. Changed onScroll to execute container.refresh() immediately instead of wrapping it in requestAnimationFrame.

v6: Modularization & Manual DOM Sync (Selection)

  • Data: 10,000 items, 10 columns.
  • Scroll Test: 100 scrolls (20,000px total).
  • Results:
    • refreshCount: 100
    • refreshTime (total): ~176.9ms
    • averageRefreshTime: 1.76ms
    • totalNodes: 4500 (avg 45/frame)
    • scanCount (per frame): 0 (Maintained Zero-Scan)
  • Notes:
    • Added complex Area Selection, Copy/Paste, and Row Deletion.
    • Successfully decoupled dynamic UI states (like .dt-cell-selected) from the declarative binding framework. We now use manual DOM manipulation (applySelectionUI) during refresh to sync states.
    • This manual sync completely prevents "Dependency Floods" where scrolling would trigger heavy $class evaluations on every cell. We maintained the Zero-Scan status while supporting rich interactions.
    • Fixed a VirtualScroll jumping bug at row 70+ by introducing an options.itemHeight configuration to the base VirtualScroll module. DataTable now explicitly passes { itemHeight: 40 } during instantiation. This elegantly bypasses expensive getComputedStyle and offsetHeight measurements while perfectly seeding the internal height map, completely eliminating layout thrashing and scrolling jank without requiring users to pollute their business data with _itemHeight.
    • Scroll Initiation Fix: Removed the setTimeout wrapper around vs.init during reset. Previously, the first scroll often hit a "blank wall" because VirtualScroll's internal metrics hadn't finished initializing when the user made their first swift scroll motion. Synchronous initialization resolved this completely.