pareto optimal writes: > Using =emacs -Q= to tangle org files with more than over 100 noweb-refs gets slow fast. > > Given this org code for N=2: > Using Gcc Emacs 28.0.91 (which I typicall use) I get these results: > > | N blocks | runtime | # of GCs | > |----------+---------+----------| > |       10 |   0.027 |        0 | > |       20 |   0.049 |        0 | > |       40 |   0.121 |        0 | > |       80 |   0.391 |        0 | > |      160 |   1.426 |        0 | > |      320 |   6.765 |        0 | > |      640 |  23.972 |        0 | > > so roughly it scales like: > > #+begin_example > 0.8x (10-20) > 2.5x  (20-40) > 3x  (40-80) > 3.5x  (160-320) > 4x  (320-640) > #+end_example > > Though I'm not sure how much that can tell us... my guess is noweb-ref's don't use a dictionary with =O(1)= lookups? Thanks for the nice benchmark and for providing a test case! You are using stable version of Org. We did some important performance improvements on main. The same benchmark using latest main (26decec): | N blocks | runtime | # of GCs | |----------+---------+----------| | 10 | 0.030 | 0 | | 20 | 0.067 | 0 | | 40 | 0.065 | 0 | | 80 | 0.081 | 0 | | 160 | 0.214 | 0 | | 320 | 0.597 | 0 | | 640 | 2.225 | 0 | | 1280 | 9.221 | 0 | | 2560 | 36.966 | 0 | And with disabled self-verification code: (setq org-element--cache-self-verify nil) | N blocks | runtime | # of GCs | |----------+---------+----------| | 10 | 0.078 | 0 | | 20 | 0.075 | 0 | | 40 | 0.063 | 0 | | 80 | 0.085 | 0 | | 160 | 0.095 | 0 | | 320 | 0.178 | 0 | | 640 | 0.311 | 0 | | 1280 | 0.819 | 0 | | 2560 | 2.302 | 0 | | 5120 | 8.878 | 0 | | 10240 | 32.706 | 0 | Graphical comparison: