Here's a first draft of a new union.scm. On my YeeLoong 8101B, when building my 155-package profile, it uses about 1/14 as much CPU time (25 seconds vs 6 minutes), and about 2/7 as much real time (2 minutes vs about 7.17 minutes). It also handles libffi in core-updates properly. A few notes: * For now, I'm using a hash table, because it turned out to be rather awkward to use a vhash for this. I can make it purely functional later if it's deemed important. * I've not yet updated tests/union.scm, which tests internal procedures in union.scm that no longer exist. * Although I can now run union-build in 2 minutes, another full minute is spent in 'display-search-paths', plus another 30-40 seconds in 'guix package' before the profile build begins. In the end, the total time for "guix package -i" goes from around 8.5 minutes to around 3.5 minutes: a significant improvement, but there's still more code for me to look at trying to optimize. Instead of a patch, I've simply attached the new union.scm. The only code they have in common is 'file=?', which is unchanged. Comments and suggestions welcome, Mark