Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/link: loading N packages takes O(N²) time #20578
There are some deduplication scans in the linker to avoid loading the same package (same import path) multiple times. These use a linear scan over all packages already loaded, so loading N packages takes O(N²) time (even with no duplicates). These scans should be replaced by map checks, cutting the time for N packages to O(N).
I have a CL and will send it.
Programs built from N libraries required O(N²) time to do the deduplication checks, even if there were never any duplicates. In most programs N is small enough not to worry, but this may affect large programs. Noticed by inspection, not any specific bug report. Fixes golang#20578. Change-Id: Ic4108f1058be39da990a79b1e0b8ce95fde44cef Reviewed-on: https://go-review.googlesource.com/44852 Run-TryBot: Russ Cox <email@example.com> TryBot-Result: Gobot Gobot <firstname.lastname@example.org> Reviewed-by: Ian Lance Taylor <email@example.com>