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
F15514686: D20477.id48849.diff
Fri, Apr 18, 4:31 AM
F15498280: D20477.id48944.diff
Sun, Apr 13, 12:30 PM
F15492380: D20477.id48849.diff
Sat, Apr 12, 1:53 PM
F15475124: D20477.id.diff
Sun, Apr 6, 4:02 PM
F15472898: D20477.diff
Sat, Apr 5, 5:24 PM
F15457257: D20477.diff
Sun, Mar 30, 3:17 PM
F15427707: D20477.diff
Sun, Mar 23, 3:43 PM
F15415488: D20477.id48849.diff
Thu, Mar 20, 6:13 AM
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