New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/compile: too many LEAQ/LEAL instructions on amd64, 386 #1914
Labels
Milestone
Comments
zhai@zhai$ objdump -d $GOROOT/bin/godoc | awk -F'\t' 'BEGIN{OFMT="%5.2f"}/^ /{s=substr($3,1,7);if (s!="") map[s]++;n++ }END{for (s in map) print map[s]"\t"map[s]/n*100" "s; print n}' | sort -n 4647 1.26883 sub 4981 1.36002 ja 6279 1.71443 ret 7194 1.96426 xor 13563 3.70327 movl 15572 4.25181 add 16650 4.54615 cmp 20891 5.70412 cld // too many cld 24779 6.76571 call 45227 12.3489 lea 46036 12.5698 movsl 109359 29.8596 mov 366244 |
I think there are still some lingering. Try linking with 6l -a and grep the output for LEAQ.*SP. Most LEAQ n(SP), R (for any register R) are indicative of a problem to be fixed. The most common pattern is LEAQ 10(SP), AX MOVQ x, 0(AX) MOVQ y, 4(AX) and also with the moves going the other way. These should just use 10(SP) and 14(SP) and avoid the LEAQ, which will registerize better. |
See http://golang.org/cl/6489067/ for a step towards resolution of this. |
After apply CL 6489067, 6493099, 6494107, 6501110 on today's tip benchmark old ns/op new ns/op delta BenchmarkCodeEncoder 118455100 99560900 -15.95% BenchmarkCodeMarshal 123140450 102622900 -16.66% BenchmarkCodeDecoder 360685800 355718200 -1.38% BenchmarkCodeUnmarshal 516606800 354142200 -31.45% BenchmarkCodeUnmarshalReuse 506730200 346208400 -31.68% BenchmarkSkipValue 33405060 30414140 -8.95% Notable frame size reductions: src/pkg/fmt/print.go:851) TEXT (*pp).printReflectValue+0(SB),$2224-56 src/pkg/fmt/print.go:851) TEXT (*pp).printReflectValue+0(SB),$1400-56 src/pkg/encoding/json/decode.go:616) TEXT (*decodeState).literalStore+0(SB),$960-56 src/pkg/encoding/json/decode.go:616) TEXT (*decodeState).literalStore+0(SB),$632-56 src/pkg/reflect/value.go:350) TEXT Value.call+0(SB),$1024-72 src/pkg/reflect/value.go:350) TEXT Value.call+0(SB),$792-72 |
There's not really a difference in the shootout. I think the json benchmark differences are entirely caused by the displacement of stack splits. The go1 benchmark suite has very random results: benchmark old ns/op new ns/op delta BenchmarkBinaryTree17 7915835000 7861939000 -0.68% BenchmarkFannkuch11 4950781000 4949182000 -0.03% BenchmarkGobDecode 28233020 26061040 -7.69% BenchmarkGobEncode 17074820 28036010 +64.20% BenchmarkGzip 737569600 743740200 +0.84% BenchmarkGunzip 209303500 204007200 -2.53% BenchmarkJSONEncode 120488400 98826400 -17.98% BenchmarkJSONDecode 527092400 346794200 -34.21% BenchmarkMandelbrot200 8997515 9001385 +0.04% BenchmarkParse 10048985 9788460 -2.59% BenchmarkRevcomp 1500392000 1508287000 +0.53% BenchmarkTemplate 420592000 387395600 -7.89% In the new code, GobEncode falls into a pathological stack split that consumes 30% of CPU time. |
Labels changed: added go1.2maybe. Owner changed to @rsc. |
Issue #7014 has been merged into this issue. |
josharian
added a commit
to josharian/go
that referenced
this issue
Jan 9, 2015
Fix a flipped nil check. The flipped check prevented componentgen from zeroing a non-cadable nl. This fix reduces the number of non-SB LEAQs in godoc from 35323 to 34920 (-1.1%). Update golang#1914 Change-Id: I15ea303068835f606f883ddf4a2bb4cb2287e9ae
josharian
added a commit
that referenced
this issue
Feb 13, 2015
Fix a flipped nil check. The flipped check prevented componentgen from zeroing a non-cadable nl. This fix reduces the number of non-SB LEAQs in godoc from 35323 to 34920 (-1.1%). Update #1914 Change-Id: I15ea303068835f606f883ddf4a2bb4cb2287e9ae Reviewed-on: https://go-review.googlesource.com/2605 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
rsc
changed the title
cmd/6g, cmd/8g: too many LEAQ/LEAL instructions
cmd/compile: too many LEAQ/LEAL instructions on amd64, 386
Jun 8, 2015
Fixed with the SSA compiler. |
Hooray! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: