I'm running into this issue now.
One thing I noticed is that if you have broken links (and
org-export-with-broken-links is t), org-id-update-id-locations will be
run for every broken link it finds. This turns out to be quite slow and
unnecessary since no files will have changed in between
org-id-update-id-locations runs during export.
One hacky workaround is to temporarily disable
org-id-update-id-locations, like so:
(cl-letf (((symbol-function 'org-id-update-id-locations)
(lambda (&optional files silent) (message "Not updating
locations"))))
(let ((org-export-with-broken-links t)
(gc-cons-threshold 80000000))
(org-icalendar-combine-agenda-files)))
The right solution would probably be to not have broken links in the
first place. :P
Or maybe org-id-update-id-locations could be debounced or cached in some way.
Best,
Josh