`org-table-align' may benefit from recent `org-table-to-lisp' speed-up. The current code contains the following lines in org-table.el. They parse the table into a Lisp structure, which is precisely what `org-table-to-lisp' is supposed to do.
(fields (mapcar (lambda (l) (and (not (string-match-p org-table-hline-regexp l)) (org-split-string l "[ \t]*|[ \t]*"))) (split-string (buffer-substring beg end) "\n" t))) Just replace them by a call to `org-table-to-lisp': (fields (cl-loop for row in (org-table-to-lisp) collect (and (listp row) row))) I made a benchmark on a large table (10000 rows, 6 columns). Adding a column, then removing it, M-S-right M-S-left. I measured time and memory with profiler-*, taking care to call `garbage-collect' beforehand. Conclusions: - `org-table-align' is faster, overall operation is faster - there is much less garbage collection - memory allocation is significantly lower | | current | new | % | |----------------------------------+-----------+-----------+-----| | org-table-align CPU samples | 1313 | 1102 | 16. | | overall CPU samples | 2040 | 1628 | 20. | | GC CPU samples | 4283 | 2609 | 39. | | overall allocated bytes | 622087730 | 272436087 | 56. | | org-table-align allocated bytes | 445910318 | 146646065 | 67. | #+TBLFM: $4=100*($-2-$-1)/$-2;f0 Note: running twice the same bench yields slightly different results. Have fun Thierry