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

Issue 107180044: code review 107180044: image/jpeg: unroll the IDCT loop. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
9 years, 10 months ago by nigeltao
Modified:
9 years, 10 months ago
Reviewers:
r, rsc
CC:
bradfitz, wathiede, golang-codereviews
Visibility:
Public.

Description

image/jpeg: unroll the IDCT loop. The fundamental gain is bounds check elimination for 6g during array indexing. The "x7 := src[y8+3]" generated code that used to be: 000000000042d174: MOVQ CX, DX 000000000042d177: ADDQ $0x3, DX 000000000042d17b: CMPQ $0x40, DX 000000000042d17f: JAE 0x42d381 000000000042d185: LEAQ 0(AX)(DX*4), BX 000000000042d189: MOVL 0(BX), DI 000000000042d381: CALL runtime.panicindex(SB) 000000000042d386: UD2 becomes eight separate single-instruction translations of a constant array offset like: 000000000042dcbe: MOVL 0xcc(AX), DX In the CPU profile for decoding a baseline JPEG, idct drops from 21% of the CPU time to 13%. benchmark old ns/op new ns/op delta BenchmarkIDCT 2124 1319 -37.90% BenchmarkDecodeBaseline 1220819 1137013 -6.86% BenchmarkDecodeProgressive 1947365 1857279 -4.63% benchmark old MB/s new MB/s speedup BenchmarkDecodeBaseline 50.62 54.35 1.07x BenchmarkDecodeProgressive 31.74 33.27 1.05x

Patch Set 1 #

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

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

Unified diffs Side-by-side diffs Delta from patch set Stats (+1223 lines, -95 lines) Patch
A src/pkg/image/jpeg/gen.go View 1 1 chunk +106 lines, -0 lines 0 comments Download
M src/pkg/image/jpeg/idct.go.pregen View 1 2 chunks +92 lines, -95 lines 0 comments Download
A src/pkg/image/jpeg/loop.go View 1 1 chunk +1021 lines, -0 lines 0 comments Download
M src/pkg/image/jpeg/reader.go View 1 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 3
nigeltao
Hello r@golang.org, rsc@golang.org (cc: bradfitz@golang.org, couchmoney@gmail.com, golang-codereviews@googlegroups.com), I'd like you to review this change to ...
9 years, 10 months ago (2014-06-19 05:12:40 UTC) #1
nigeltao
r, rsc: is the benefit of a 1.06x performance gain worth the complexity cost of ...
9 years, 10 months ago (2014-06-19 05:19:12 UTC) #2
nigeltao
9 years, 10 months ago (2014-06-27 08:12:54 UTC) #3
*** Abandoned ***
Sign in to reply to this message.

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