Page MenuHomePhabricator

Improve the performance of tab replacement in common cases
ClosedPublic

Authored by epriestley on Apr 25 2019, 9:38 PM.
Tags
None
Referenced Files
F19827121: D20477.id48944.diff
Mar 9 2026, 6:07 AM
F19824023: D20477.id.diff
Mar 7 2026, 6:21 PM
F19816133: D20477.diff
Mar 5 2026, 4:13 AM
F19676151: D20477.id.diff
Feb 8 2026, 11:22 AM
F19525999: D20477.id.diff
Jan 18 2026, 1:18 PM
F19516899: D20477.id48849.diff
Jan 15 2026, 5:23 AM
F19023874: D20477.id.diff
Nov 24 2025, 2:01 AM
F18923999: D20477.diff
Nov 9 2025, 5:15 PM
Subscribers
None

Details

Summary

See PHI1210. For certain large inputs, we spend more time than we need to replacing tabs with spaces. Add some fast paths:

  • When a line only has tabs at the beginning of the line, we don't need to do as much work parsing the rest of the line.
  • When a line has no unicode characters, we don't need to vectorize it to get the right result.
Test Plan
  • Added test coverage.
  • Profiled this, got a ~60x performance increase on a 36,000 line 3MB text file.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable