From d624ee6d7eb4fa1c1c53d50271f3f591264853f5 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Fri, 13 Jul 2018 23:34:43 -0400 Subject: [PATCH] linker: Use sequences for stacks (instead of trees) This has a significant performance impact: processing time is cut in about half and memory usage is reduced by more than 50%. For example, a package that previously took 30s and 2.1GiB of memory to link now takes 14s and less than 900MiB of memory. I had tried to perform this optimization a couple years ago but was thwarted (I think) by the classifier markers. The previous commit did away with those. I'm encouraged by the gains from the low-hanging fruit. * src/current/compiler/linker.xsl (l:process-empty, l:stack-empty): Convert from l:pstack and l:sym-stack (respectively) to empty preproc:sym sequences. (l:depgen-process-sym)[preproc:sym]: Append to sequence rather than outputting new l:sym-stack tree. Update all annotations and uses accordingly. --- src/current/compiler/linker.xsl | 89 +++++++++++++++------------------ 1 file changed, 41 insertions(+), 48 deletions(-) diff --git a/src/current/compiler/linker.xsl b/src/current/compiler/linker.xsl index cb7b4e25..65fb57f8 100644 --- a/src/current/compiler/linker.xsl +++ b/src/current/compiler/linker.xsl @@ -57,13 +57,11 @@ - - - + - - - +