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

Issue 4267050: code review 4267050: strings: add IndexRune tests, ASCII fast path (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years ago by bradfitz
Modified:
14 years ago
Reviewers:
r, bradfitzgoog, r2
CC:
rsc, dsymonds, golang-dev
Visibility:
Public.

Description

strings: add IndexRune tests, ASCII fast path $ gotest -test.v -test.run=IndexRune -test.bench=.* === RUN strings_test.TestIndexRune --- PASS: strings_test.TestIndexRune (0.0 seconds) PASS strings_test.BenchmarkIndexRune 20000000 105 ns/op strings_test.BenchmarkIndexByte 50000000 48 ns/op

Patch Set 1 #

Patch Set 2 : diff -r 7570d405bc93 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 7570d405bc93 https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r 3abc08a0a1fe https://go.googlecode.com/hg/ #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+53 lines, -3 lines) Patch
M src/pkg/strings/strings.go View 1 1 chunk +13 lines, -3 lines 2 comments Download
M src/pkg/strings/strings_test.go View 1 2 chunks +40 lines, -0 lines 0 comments Download

Messages

Total messages: 11
bradfitz
Hello rsc (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
14 years ago (2011-03-08 17:24:13 UTC) #1
dsymonds
On Tue, Mar 8, 2011 at 9:24 AM, <bradfitz@golang.org> wrote: > $ gotest -test.v -test.run=IndexRune ...
14 years ago (2011-03-08 17:27:13 UTC) #2
rsc
LGTM
14 years ago (2011-03-08 17:29:23 UTC) #3
bradfitz
On Tue, Mar 8, 2011 at 9:27 AM, David Symonds <dsymonds@golang.org> wrote: > On Tue, ...
14 years ago (2011-03-08 17:37:31 UTC) #4
dsymonds
On Tue, Mar 8, 2011 at 9:37 AM, Brad Fitzpatrick <bradfitz@golang.org> wrote: > On Tue, ...
14 years ago (2011-03-08 17:38:56 UTC) #5
bradfitz
*** Submitted as http://code.google.com/p/go/source/detail?r=ff97eda79397 *** strings: add IndexRune tests, ASCII fast path $ gotest -test.v ...
14 years ago (2011-03-08 17:41:15 UTC) #6
bradfitzgoog
On Tue, Mar 8, 2011 at 9:38 AM, David Symonds <dsymonds@golang.org> wrote: > On Tue, ...
14 years ago (2011-03-08 17:42:45 UTC) #7
dsymonds
LGTM On Tue, Mar 8, 2011 at 9:42 AM, Brad Fitzpatrick <bradfitz@google.com> wrote: > It ...
14 years ago (2011-03-08 17:45:00 UTC) #8
r
http://codereview.appspot.com/4267050/diff/1003/src/pkg/strings/strings.go File src/pkg/strings/strings.go (right): http://codereview.appspot.com/4267050/diff/1003/src/pkg/strings/strings.go#newcode123 src/pkg/strings/strings.go:123: case rune < 0x80: why not an if statement? ...
14 years ago (2011-03-08 17:58:27 UTC) #9
bradfitzgoog
http://codereview.appspot.com/4267050/diff/1003/src/pkg/strings/strings.go File src/pkg/strings/strings.go (right): http://codereview.appspot.com/4267050/diff/1003/src/pkg/strings/strings.go#newcode123 src/pkg/strings/strings.go:123: case rune < 0x80: On 2011/03/08 17:58:27, r wrote: ...
14 years ago (2011-03-08 18:01:00 UTC) #10
r2
14 years ago (2011-03-08 18:05:49 UTC) #11
On Mar 8, 2011, at 10:01 AM, bradfitz@google.com wrote:

> 
> http://codereview.appspot.com/4267050/diff/1003/src/pkg/strings/strings.go
> File src/pkg/strings/strings.go (right):
> 
>
http://codereview.appspot.com/4267050/diff/1003/src/pkg/strings/strings.go#ne...
> src/pkg/strings/strings.go:123: case rune < 0x80:
> On 2011/03/08 17:58:27, r wrote:
>> why not an if statement?  when i see 'switch' i think something more
> interesting
>> is coming than a single comparison.
> 
> I always got the impression that Go was switch-happy. I tend to use if
> statements but I've been told a number of times to use a switch instead.
> From now on I'll use if when there's fewer than 3 cases.

thanks.  switches beat long if-else chains for sure.  how long the chain must be
is debatable but it's certainly greater than 2.

-rob

Sign in to reply to this message.

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