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

Issue 40370061: code review 40370061: runtime: do not zero terminate strings (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 3 months ago by dvyukov
Modified:
11 years, 2 months ago
Reviewers:
r
CC:
golang-codereviews, r, bradfitz, iant
Visibility:
Public.

Description

runtime: do not zero terminate strings On top of "tiny allocator" (cl/38750047), reduces number of allocs by 1% on json. No code must rely on zero termination. So will also make debugging simpler, by uncovering issues earlier. json-1 allocated 7949686 7915766 -0.43% allocs 93778 92790 -1.05% time 100957795 97250949 -3.67% rest of the metrics are too noisy.

Patch Set 1 #

Patch Set 2 : diff -r fecb13086239 https://dvyukov%40google.com@code.google.com/p/go/ #

Patch Set 3 : diff -r 5cbae677dac9 https://dvyukov%40google.com@code.google.com/p/go/ #

Total comments: 2

Patch Set 4 : diff -r 7d1281494058 https://dvyukov%40google.com@code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -3 lines) Patch
M src/pkg/runtime/string.goc View 1 2 3 1 chunk +1 line, -3 lines 0 comments Download

Messages

Total messages: 11
dvyukov
Hello golang-codereviews@googlegroups.com, I'd like you to review this change to https://dvyukov%40google.com@code.google.com/p/go/
11 years, 3 months ago (2013-12-31 12:39:01 UTC) #1
r
LGTM https://codereview.appspot.com/40370061/diff/40001/src/pkg/runtime/string.goc File src/pkg/runtime/string.goc (right): https://codereview.appspot.com/40370061/diff/40001/src/pkg/runtime/string.goc#newcode49 src/pkg/runtime/string.goc:49: // leave room for NUL for C runtime ...
11 years, 3 months ago (2013-12-31 19:20:00 UTC) #2
dvyukov
This may break existing SWIG binding, because they may check str.p[str.n] looking for zero terminator, ...
11 years, 3 months ago (2014-01-17 07:38:14 UTC) #3
bradfitz
So updated SWIG code mapping from gostring->char* would always have to alloc + copy, right? ...
11 years, 3 months ago (2014-01-17 17:38:44 UTC) #4
dvyukov
On 2014/01/17 17:38:44, bradfitz wrote: > So updated SWIG code mapping from gostring->char* would always ...
11 years, 3 months ago (2014-01-17 18:10:53 UTC) #5
bradfitz
On Fri, Jan 17, 2014 at 10:10 AM, <dvyukov@google.com> wrote: > On 2014/01/17 17:38:44, bradfitz ...
11 years, 3 months ago (2014-01-17 18:13:00 UTC) #6
iant
On Fri, Jan 17, 2014 at 10:12 AM, Brad Fitzpatrick <bradfitz@golang.org> wrote: > > What ...
11 years, 3 months ago (2014-01-17 18:46:11 UTC) #7
bradfitz
On Fri, Jan 17, 2014 at 10:46 AM, Ian Lance Taylor <iant@golang.org> wrote: > On ...
11 years, 3 months ago (2014-01-17 18:49:30 UTC) #8
dvyukov
On Fri, Jan 17, 2014 at 10:49 PM, Brad Fitzpatrick <bradfitz@golang.org> wrote: > On Fri, ...
11 years, 3 months ago (2014-01-18 15:32:32 UTC) #9
dvyukov
https://codereview.appspot.com/40370061/diff/40001/src/pkg/runtime/string.goc File src/pkg/runtime/string.goc (right): https://codereview.appspot.com/40370061/diff/40001/src/pkg/runtime/string.goc#newcode49 src/pkg/runtime/string.goc:49: // leave room for NUL for C runtime (e.g., ...
11 years, 2 months ago (2014-01-24 18:29:09 UTC) #10
dvyukov
11 years, 2 months ago (2014-01-24 18:29:25 UTC) #11
*** Submitted as https://code.google.com/p/go/source/detail?r=50f52d5c2bb7 ***

runtime: do not zero terminate strings
On top of "tiny allocator" (cl/38750047), reduces number of allocs by 1% on
json.
No code must rely on zero termination. So will also make debugging simpler,
by uncovering issues earlier.

json-1
allocated                 7949686      7915766      -0.43%
allocs                      93778        92790      -1.05%
time                    100957795     97250949      -3.67%
rest of the metrics are too noisy.

LGTM=r
R=golang-codereviews, r, bradfitz, iant
CC=golang-codereviews
https://codereview.appspot.com/40370061
Sign in to reply to this message.

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