Skip to content

perf(sandbox): bound stderr carry to avoid O(n²) on huge lines #427

Description

@ZhuchkaTriplesix

Parent

Part of #414

Problem

sandbox_stderr_pipe rebuilds carry via toString() + split('\\n') on each chunk. A plugin emitting a huge line without newline → O(n²) copies + heavy sanitize regexes.

Evidence

  • lib/core/extensions/sandbox/sandbox_stderr_pipe.dart
  • lib/core/extensions/sandbox/sandbox_sanitizer.dart

Acceptance

  • Carry buffer size capped; overflow truncated or flushed safely
  • Newline scan without full-string rebuild each chunk
  • Sanitize input length bounded

Suggested fix

Cap carry; scan for newlines incrementally; bound sanitize input.

Metadata

Metadata

Labels

coreCore library logic and servicesperformanceTheme parser epic label: performance

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions