Skip to content

perf(export): stream DataExportService to disk (stop giant String) #417

Description

@ZhuchkaTriplesix

Parent

Part of #414

Problem

Primary export UI path (DataExportService.formatAsync / saveToFile) builds one giant String (CSV/JSON/Markdown/SQL) on an isolate, then File.writeAsString.

Streaming helper writeResultGridCsv already exists but is not used by this path. Wide × 10⁵-row grids → O(cells) heap + full matrix copy into the isolate.

Evidence

  • lib/shared/services/data_export_service.dart (~147–219)
  • Callers: results_tab.dart, extension_table_view.dart
  • Unused stream: lib/core/csv/result_grid_csv.dart (writeResultGridCsv)

Related

#277 fixed sync UI-isolate CSV freezes; this is the remaining full-document materialization issue across formats.

Acceptance

  • File export streams to IOSink for CSV (and preferably JSON/SQL)
  • UI wires large exports through streaming path; clipboard may stay string-based with size guard
  • No full-string build for file export of ≥N rows (document threshold)
  • Smoke test / unit test for streamed write

Suggested fix

Reuse writeResultGridCsv; add streaming JSON/SQL writers; “export to file only” for oversized sets.

Metadata

Metadata

Labels

coreCore library logic and servicesperformanceTheme parser epic label: performanceuiUser interface components and widgets

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions