tbanelwebmin <[email protected]> writes: > I did some optimizations by looking at hot-spots and bugs. This is a > much less ambitious work than the one envisioned by John. But the gains > are still worthwhile. For instance, I published this function: > > (defun orgtbl-aggregate--recalculate-fast () > "Wrapper around `org-table-recalculate'. > The standard `org-table-recalculate' function is slow because > it must handle lots of cases. Here the table is freshly created, > therefore a lot of special handling and cache updates can be > safely bypassed. Moreover, the alignment of the resulting table > is delegated to orgtbl-aggregate, which is fast. > The result is a speedup up to x6, and a memory consumption > divided by up to 5. It makes a difference for large tables." > (let ((old (symbol-function 'org-table-goto-column))) > (cl-letf (((symbol-function 'org-fold-core--fix-folded-region) > (lambda (_a _b _c)))
Why do you need this? `org-table-recalculate' already has `org-fold-core-ignore-modifications'. > ((symbol-function 'jit-lock-after-change) > (lambda (_a _b _c))) This will likely cause bugs. If you really want to avoid triggering change hooks, combine-change-calls is more appropriate, but I would like to see the profile for this. jit-lock is generally very fast and runs on timer. If it is slow, we may probably report it to Emacs devs and fix there. > ;; Warning: this org-table-goto-column trick fixes a bug > ;; in org-table.el around line 3084, when computing > ;; column-count. The bug prevents single-cell formulas > ;; creating the cell in some rare cases. > ((symbol-function 'org-table-goto-column) > (lambda (n &optional on-delim _force) > ;; △ > ;;╭───────────────────────────╯ > ;;╰╴parameter is forcibly changed to t╶─╮ > ;; ╭───────────────╯ > ;; ▽ > (funcall old n on-delim t)))) I would be happy to see a bug report with more details. > (condition-case nil > (org-table-recalculate t t) > ;; △ △ > ;; for all lines╶────────╯ │ > ;; do not re-align╶────────╯ This may be faster, but is probably a regression. Maybe there is a better way? -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>
