The code looks good. Can we keep the original or a pseudo-code equivalent around as ...
10 years, 12 months ago
(2014-06-17 00:43:43 UTC)
#3
The code looks good.
Can we keep the original or a pseudo-code equivalent around as a comment
somewhere? It's useful to have readable reference implementations.
Is it worth a Duff's device for ARM's inlined comparison?
If we do keep the original, it'd be nice to keep it building as well. ...
10 years, 12 months ago
(2014-06-17 00:51:35 UTC)
#4
If we do keep the original, it'd be nice to keep it building as well.
Ideally tested, but that's a stretch here. We jump through those hoops
with the portable implementations in crypto/* which no longer are used in
the general case.
In lieu of that, some short summary comments on the assembly would probably
suffice.
On Mon, Jun 16, 2014 at 5:43 PM, <josharian@gmail.com> wrote:
> The code looks good.
>
> Can we keep the original or a pseudo-code equivalent around as a comment
> somewhere? It's useful to have readable reference implementations.
>
> Is it worth a Duff's device for ARM's inlined comparison?
>
>
> https://codereview.appspot.com/105280044/
>
LG on linux/arm [root@alarmcbi runtime]# benchcmp {old,new}.txt benchmark old ns/op new ns/op delta BenchmarkCompareStringEqual 220 ...
10 years, 12 months ago
(2014-06-17 01:46:25 UTC)
#6
LG on linux/arm
[root@alarmcbi runtime]# benchcmp {old,new}.txt
benchmark old ns/op new ns/op delta
BenchmarkCompareStringEqual 220 128 -41.82%
BenchmarkCompareStringIdentical 42.8 27.6 -35.51%
BenchmarkCompareStringSameLength 99.3 96.5 -2.82%
BenchmarkCompareStringDifferentLength 8.20 9.05 +10.37%
BenchmarkCompareStringBigUnaligned 6047583 5784357 -4.35%
BenchmarkCompareStringBig 5282953 5271501 -0.22%
benchmark old MB/s new MB/s speedup
BenchmarkCompareStringBigUnaligned 173.39 181.28 1.05x
BenchmarkCompareStringBig 198.48 198.92 1.00x
ARM aficioandos can probably recover the 0.85 of a ns lost in
BenchmarkCompareStringDifferentLength, I don't think it should block this
review.
On Mon, Jun 16, 2014 at 5:43 PM, <josharian@gmail.com> wrote: > The code looks good. ...
10 years, 12 months ago
(2014-06-17 02:24:37 UTC)
#9
On Mon, Jun 16, 2014 at 5:43 PM, <josharian@gmail.com> wrote:
> The code looks good.
>
> Can we keep the original or a pseudo-code equivalent around as a comment
> somewhere? It's useful to have readable reference implementations.
>
Yes, I'll put it somewhere. Perhaps a Go version in a test file that
compares
against the assembly version.
>
> Is it worth a Duff's device for ARM's inlined comparison?
>
Might be useful.
>
>
> https://codereview.appspot.com/105280044/
>
All fixed up. PTAL. On Mon, Jun 16, 2014 at 7:24 PM, Keith Randall <khr@google.com> ...
10 years, 12 months ago
(2014-06-17 02:46:08 UTC)
#10
All fixed up. PTAL.
On Mon, Jun 16, 2014 at 7:24 PM, Keith Randall <khr@google.com> wrote:
>
>
>
> On Mon, Jun 16, 2014 at 5:43 PM, <josharian@gmail.com> wrote:
>
>> The code looks good.
>>
>> Can we keep the original or a pseudo-code equivalent around as a comment
>> somewhere? It's useful to have readable reference implementations.
>>
>
> Yes, I'll put it somewhere. Perhaps a Go version in a test file that
> compares
> against the assembly version.
>
>
>>
>> Is it worth a Duff's device for ARM's inlined comparison?
>>
>
> Might be useful.
>
>
>>
>>
>> https://codereview.appspot.com/105280044/
>>
>
>
On Mon, Jun 16, 2014 at 7:53 PM, <bradfitz@golang.org> wrote: > LGTM > > > ...
10 years, 12 months ago
(2014-06-17 03:09:49 UTC)
#12
On Mon, Jun 16, 2014 at 7:53 PM, <bradfitz@golang.org> wrote:
> LGTM
>
>
>
> https://codereview.appspot.com/105280044/diff/80001/src/
> pkg/runtime/asm_amd64p32.s
> File src/pkg/runtime/asm_amd64p32.s (right):
>
> https://codereview.appspot.com/105280044/diff/80001/src/
> pkg/runtime/asm_amd64p32.s#newcode720
> src/pkg/runtime/asm_amd64p32.s:720: // equivlaent Go code.
> typo: equivalent. here and other files too.
>
> https://codereview.appspot.com/105280044/diff/80001/src/
> pkg/runtime/runtime_test.go
> File src/pkg/runtime/runtime_test.go (right):
>
> https://codereview.appspot.com/105280044/diff/80001/src/
> pkg/runtime/runtime_test.go#newcode210
> src/pkg/runtime/runtime_test.go:210: for i := 0; i < len(s1); i++ {
> doesn't do equivalent of
>
> if &s1[0] == &s2[0] {
> return true
> }
>
> ... before the byte loop. (if the purpose of this function is
> documentation)
>
> Which I guess you'd need to do with a local version of
> reflect.SliceHeader.
>
>
I don't think I want to go there. It's just an optimization the assembly
(and the old C code) happens to do, it's not part of the spec.
> https://codereview.appspot.com/105280044/diff/80001/src/
> pkg/runtime/runtime_test.go#newcode227
> src/pkg/runtime/runtime_test.go:227: "ccc",
> make one of the strings equal but different?
>
> "ccc",
> "cccc"[:3],
>
> To test the above pointer+len equal case?
>
Sure. I worry about "cccc"[:3] being evaluated at compile time though.
Perhaps something more devious?
>
> https://codereview.appspot.com/105280044/
>
LGTM > > make one of the strings equal but different? > > > > ...
10 years, 12 months ago
(2014-06-17 03:20:32 UTC)
#13
LGTM
> > make one of the strings equal but different?
> >
> > "ccc",
> > "cccc"[:3],
> >
> > To test the above pointer+len equal case?
>
> Sure. I worry about "cccc"[:3] being evaluated at compile time though.
> Perhaps something more devious?
You could pass it through a non-inlinable function:
func prefix(s string) string {
defer func() {}() // prevent inlining
return s[:3]
}
prefix("cccc")
At least add a comment in the code like my pseudo code? The assembly refers ...
10 years, 12 months ago
(2014-06-17 03:22:16 UTC)
#14
At least add a comment in the code like my pseudo code? The assembly refers
to this code as "equivalent". I know the spec doesn't define how equality
is implemented but I thought we were showing one implementation to explain
another implementation.
On Jun 16, 2014 8:09 PM, "Keith Randall" <khr@google.com> wrote:
>
>
>
> On Mon, Jun 16, 2014 at 7:53 PM, <bradfitz@golang.org> wrote:
>
>> LGTM
>>
>>
>>
>> https://codereview.appspot.com/105280044/diff/80001/src/
>> pkg/runtime/asm_amd64p32.s
>> File src/pkg/runtime/asm_amd64p32.s (right):
>>
>> https://codereview.appspot.com/105280044/diff/80001/src/
>> pkg/runtime/asm_amd64p32.s#newcode720
>> src/pkg/runtime/asm_amd64p32.s:720: // equivlaent Go code.
>> typo: equivalent. here and other files too.
>>
>> https://codereview.appspot.com/105280044/diff/80001/src/
>> pkg/runtime/runtime_test.go
>> File src/pkg/runtime/runtime_test.go (right):
>>
>> https://codereview.appspot.com/105280044/diff/80001/src/
>> pkg/runtime/runtime_test.go#newcode210
>> src/pkg/runtime/runtime_test.go:210: for i := 0; i < len(s1); i++ {
>> doesn't do equivalent of
>>
>> if &s1[0] == &s2[0] {
>> return true
>> }
>>
>> ... before the byte loop. (if the purpose of this function is
>> documentation)
>>
>> Which I guess you'd need to do with a local version of
>> reflect.SliceHeader.
>>
>>
> I don't think I want to go there. It's just an optimization the assembly
> (and the old C code) happens to do, it's not part of the spec.
>
>
>> https://codereview.appspot.com/105280044/diff/80001/src/
>> pkg/runtime/runtime_test.go#newcode227
>> src/pkg/runtime/runtime_test.go:227: "ccc",
>> make one of the strings equal but different?
>>
>> "ccc",
>> "cccc"[:3],
>>
>> To test the above pointer+len equal case?
>>
>
> Sure. I worry about "cccc"[:3] being evaluated at compile time though.
> Perhaps something more devious?
>
>
>>
>> https://codereview.appspot.com/105280044/
>>
>
>
Issue 105280044: code review 105280044: runtime: implement eqstring in assembly.
(Closed)
Created 10 years, 12 months ago by khr
Modified 10 years, 12 months ago
Reviewers: cahooon
Base URL:
Comments: 3