cmd/internal/gc: clean up componentgen
This is primarily about making the code clearer, but as part of the cleanup componentgen is now much more consistent about what it does and does not attempt. The new limit is to 8 move instructions. The old limit was either 3 or 4 small things but in the details it was quite inconsistent: ints, interfaces, strings, and slices all counted as small; it handled a struct containing two ints, but not a struct containing a struct containing two ints; it handled slices and interfaces and a struct containing a slice but not a struct containing an interface; and so on. The new code runs at about the same speed as the old code if limited to 4 moves, but that's much more restrictive when the pieces are strings or interfaces. With the limit raised to 8 moves, this CL is sometimes a significant improvement: benchmark old ns/op new ns/op delta BenchmarkBinaryTree17 4361174290 4362870005 +0.04% BenchmarkFannkuch11 3008201483 2974408533 -1.12% BenchmarkFmtFprintfEmpty 79.0 79.5 +0.63% BenchmarkFmtFprintfString 281 261 -7.12% BenchmarkFmtFprintfInt 264 262 -0.76% BenchmarkFmtFprintfIntInt 447 443 -0.89% BenchmarkFmtFprintfPrefixedInt 354 361 +1.98% BenchmarkFmtFprintfFloat 500 452 -9.60% BenchmarkFmtManyArgs 1688 1693 +0.30% BenchmarkGobDecode 11718456 11741179 +0.19% BenchmarkGobEncode 10144620 10161627 +0.17% BenchmarkGzip 437631642 435271877 -0.54% BenchmarkGunzip 109468858 110173606 +0.64% BenchmarkHTTPClientServer 76248 75362 -1.16% BenchmarkJSONEncode 24160474 23753091 -1.69% BenchmarkJSONDecode 84470041 82902026 -1.86% BenchmarkMandelbrot200 4676857 4687040 +0.22% BenchmarkGoParse 4954602 4923965 -0.62% BenchmarkRegexpMatchEasy0_32 151 151 +0.00% BenchmarkRegexpMatchEasy0_1K 450 452 +0.44% BenchmarkRegexpMatchEasy1_32 131 130 -0.76% BenchmarkRegexpMatchEasy1_1K 713 695 -2.52% BenchmarkRegexpMatchMedium_32 227 218 -3.96% BenchmarkRegexpMatchMedium_1K 63911 62966 -1.48% BenchmarkRegexpMatchHard_32 3163 3026 -4.33% BenchmarkRegexpMatchHard_1K 93985 90266 -3.96% BenchmarkRevcomp 650697093 649211600 -0.23% BenchmarkTemplate 107049170 106804076 -0.23% BenchmarkTimeParse 448 452 +0.89% BenchmarkTimeFormat 468 460 -1.71% Change-Id: I08563133883e88bb9db9e9e4dee438a5af2787da Reviewed-on: https://go-review.googlesource.com/9004Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Showing
Please register or sign in to comment