Page MenuHomePhabricator

Improve the performance of tab replacement in common cases
ClosedPublic

Authored by epriestley on Thu, Apr 25, 9:38 PM.

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
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

epriestley created this revision.Thu, Apr 25, 9:38 PM
epriestley requested review of this revision.Thu, Apr 25, 9:39 PM
amckinley accepted this revision.Thu, May 16, 12:53 PM
This revision is now accepted and ready to land.Thu, May 16, 12:53 PM