There are currently three areas in the prettification pipeline where performance can be improved, especially when handling multiple tables.
- MultiTablePrettyfier initialization: avoid redundant setup for each prettification call to reduce overhead during document formatting.
- Reuse instances where possible: cache and reuse components to avoid repeated instantiation and improve efficiency (eg: PadCalculatorSelector and AlignmentMarkerStrategy).
- Avoid string concatenation in TableStringWriter: use array-based row construction instead of repeated string concatenation to reduce allocations.
These changes should lead to faster formatting of individual tables and multiple tables by reducing allocations and GC.