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

Issue 7300098: code review 7300098: net/textproto: more efficient header parsing (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 4 months ago by dave
Modified:
12 years, 4 months ago
Reviewers:
CC:
bradfitz, golang-dev
Visibility:
Public.

Description

net/textproto: more efficient header parsing A co creation with bradfitz * add fast path for header lines which are not continuations * pass hint to better size initial mime header map lucky(~/go/src/pkg/net/http) % ~/go/misc/benchcmp {golden,new}.txt benchmark old ns/op new ns/op delta BenchmarkReadRequestChrome 10073 8348 -17.12% BenchmarkReadRequestCurl 4368 4350 -0.41% BenchmarkReadRequestApachebench 4412 4397 -0.34% BenchmarkReadRequestSiege 6431 5924 -7.88% BenchmarkReadRequestWrk 2820 3146 +11.56% benchmark old MB/s new MB/s speedup BenchmarkReadRequestChrome 60.66 73.18 1.21x BenchmarkReadRequestCurl 17.85 17.93 1.00x BenchmarkReadRequestApachebench 18.58 18.65 1.00x BenchmarkReadRequestSiege 23.48 25.49 1.09x BenchmarkReadRequestWrk 14.18 12.71 0.90x benchmark old allocs new allocs delta BenchmarkReadRequestChrome 32 26 -18.75% BenchmarkReadRequestCurl 15 15 0.00% BenchmarkReadRequestApachebench 16 15 -6.25% BenchmarkReadRequestSiege 22 19 -13.64% BenchmarkReadRequestWrk 11 11 0.00% benchmark old bytes new bytes delta BenchmarkReadRequestChrome 3148 2216 -29.61% BenchmarkReadRequestCurl 905 1413 56.13% BenchmarkReadRequestApachebench 956 1413 47.80% BenchmarkReadRequestSiege 1397 1522 8.95% BenchmarkReadRequestWrk 757 1369 80.85%

Patch Set 1 #

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

Total comments: 1

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

Total comments: 5

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

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

Unified diffs Side-by-side diffs Delta from patch set Stats (+17 lines, -1 line) Patch
M src/pkg/net/textproto/reader.go View 1 2 3 4 2 chunks +12 lines, -1 line 0 comments Download
M src/pkg/net/textproto/textproto.go View 1 2 3 1 chunk +5 lines, -0 lines 0 comments Download

Messages

Total messages: 5
bradfitz
https://codereview.appspot.com/7300098/diff/2001/src/pkg/net/textproto/textproto.go File src/pkg/net/textproto/textproto.go (right): https://codereview.appspot.com/7300098/diff/2001/src/pkg/net/textproto/textproto.go#newcode152 src/pkg/net/textproto/textproto.go:152: b |= 0x20 // make upper case lower case
12 years, 4 months ago (2013-02-12 23:37:15 UTC) #1
dave_cheney.net
Hello bradfitz@golang.org (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go
12 years, 4 months ago (2013-02-13 04:57:49 UTC) #2
bradfitz
LGTM after nits https://codereview.appspot.com/7300098/diff/5002/src/pkg/net/textproto/reader.go File src/pkg/net/textproto/reader.go (right): https://codereview.appspot.com/7300098/diff/5002/src/pkg/net/textproto/reader.go#newcode131 src/pkg/net/textproto/reader.go:131: // Optimistically assume we have buffered ...
12 years, 4 months ago (2013-02-13 05:27:06 UTC) #3
dave_cheney.net
Thanks Brad, PTAL. I'll leave this a while for others to comment. https://codereview.appspot.com/7300098/diff/5002/src/pkg/net/textproto/reader.go File src/pkg/net/textproto/reader.go ...
12 years, 4 months ago (2013-02-13 09:00:21 UTC) #4
dave_cheney.net
12 years, 4 months ago (2013-02-14 08:35:51 UTC) #5
*** Submitted as https://code.google.com/p/go/source/detail?r=a394d9eeb49a ***

net/textproto: more efficient header parsing

A co creation with bradfitz

* add fast path for header lines which are not continuations
* pass hint to better size initial mime header map

lucky(~/go/src/pkg/net/http) % ~/go/misc/benchcmp {golden,new}.txt
benchmark                          old ns/op    new ns/op    delta
BenchmarkReadRequestChrome             10073         8348  -17.12%
BenchmarkReadRequestCurl                4368         4350   -0.41%
BenchmarkReadRequestApachebench         4412         4397   -0.34%
BenchmarkReadRequestSiege               6431         5924   -7.88%
BenchmarkReadRequestWrk                 2820         3146  +11.56%

benchmark                           old MB/s     new MB/s  speedup
BenchmarkReadRequestChrome             60.66        73.18    1.21x
BenchmarkReadRequestCurl               17.85        17.93    1.00x
BenchmarkReadRequestApachebench        18.58        18.65    1.00x
BenchmarkReadRequestSiege              23.48        25.49    1.09x
BenchmarkReadRequestWrk                14.18        12.71    0.90x

benchmark                         old allocs   new allocs    delta
BenchmarkReadRequestChrome                32           26  -18.75%
BenchmarkReadRequestCurl                  15           15    0.00%
BenchmarkReadRequestApachebench           16           15   -6.25%
BenchmarkReadRequestSiege                 22           19  -13.64%
BenchmarkReadRequestWrk                   11           11    0.00%

benchmark                          old bytes    new bytes    delta
BenchmarkReadRequestChrome              3148         2216  -29.61%
BenchmarkReadRequestCurl                 905         1413   56.13%
BenchmarkReadRequestApachebench          956         1413   47.80%
BenchmarkReadRequestSiege               1397         1522    8.95%
BenchmarkReadRequestWrk                  757         1369   80.85%

R=bradfitz
CC=golang-dev
https://codereview.appspot.com/7300098
Sign in to reply to this message.

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