Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(267)

Issue 137880043: cmd/gc: optimize memclr of slices and arrays (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
9 years, 7 months ago by josharian
Modified:
9 years, 2 months ago
Reviewers:
Visibility:
Public.

Description

cmd/gc: optimize memclr of slices and arrays [TODO: Use samesafeexpr from CL 159960043 instead of checking that a is an ONAME?] [TODO: Add write barriers as needed. writebarrierfat, CL 2061] [TODO: Add memset] [TODO: Respect -N compiler flag.] Update issue 5373 Recognize loops of the form for i := range a { a[i] = [zero val] } and replace them with calls to memclr. This occurs in the stdlib in three non-test functions: image/draw drawPaletted compress/flate (*huffmanBitWriter).reset math/big net.clear memset is more complicated and is left for future work. Also for future work is accepting any range expression whose evaluation is free from side-effects; see issue 7622 for a syntactic approach to that. Significant benchmark changes: runtime BenchmarkGoMemclr5 3.29 2.98 -9.42% BenchmarkGoMemclr16 13.6 3.25 -76.10% BenchmarkGoMemclr64 50.2 3.55 -92.93% BenchmarkGoMemclr256 154 6.02 -96.09% compress/flate BenchmarkEncodeTwainDefault1e4 778746 754950 -3.06% BenchmarkEncodeTwainDefault1e5 10782677 10463178 -2.96% BenchmarkEncodeTwainDefault1e6 114453656 112236189 -1.94% BenchmarkEncodeDigitsDefault1e5 12598635 12365839 -1.85% BenchmarkDecodeTwainSpeed1e4 203180 199583 -1.77% BenchmarkDecodeTwainSpeed1e6 15289086 15026232 -1.72% BenchmarkEncodeTwainSpeed1e6 28794254 28307233 -1.69% BenchmarkDecodeTwainSpeed1e5 1581313 1556212 -1.59% BenchmarkDecodeDigitsCompress1e6 14688734 14458648 -1.57% BenchmarkEncodeTwainSpeed1e4 539456 547890 +1.56% BenchmarkDecodeTwainCompress1e6 12198494 12031018 -1.37% BenchmarkDecodeTwainCompress1e5 1300425 1282819 -1.35% BenchmarkDecodeDigitsDefault1e6 14437604 14242762 -1.35% BenchmarkDecodeTwainDefault1e6 12278837 12131759 -1.20% BenchmarkEncodeDigitsCompress1e5 12640931 12490414 -1.19%

Patch Set 1 #

Patch Set 2 : diff -r e5c87cefb57fffc5767209542be5c4e58123e3c6 https://code.google.com/p/go #

Patch Set 3 : diff -r e5c87cefb57fffc5767209542be5c4e58123e3c6 https://code.google.com/p/go #

Patch Set 4 : diff -r e5c87cefb57fffc5767209542be5c4e58123e3c6 https://code.google.com/p/go #

Patch Set 5 : diff -r e5c87cefb57fffc5767209542be5c4e58123e3c6 https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+104 lines, -0 lines) Patch
M src/cmd/gc/builtin.c View 1 1 chunk +1 line, -0 lines 0 comments Download
M src/cmd/gc/range.c View 1 2 3 4 3 chunks +88 lines, -0 lines 0 comments Download
M src/cmd/gc/runtime.go View 1 1 chunk +1 line, -0 lines 0 comments Download
M src/pkg/runtime/memmove_test.go View 1 1 chunk +14 lines, -0 lines 0 comments Download

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b