LGTM Looks good except that Rietveld won't show me side-by-side diffs, and also this: + ...
12 years, 9 months ago
(2012-05-22 03:21:10 UTC)
#2
LGTM
Looks good except that Rietveld won't show me side-by-side diffs, and also
this:
+ // Split name into components.
+ s := ""
+ parts := make([]string, 0)
+ for _, c := range name {
+ if c == '.' {
+ parts = append(parts, s)
+ s = ""
+ } else {
+ s = s + string(c)
+ }
+ }
+ parts = append(parts, s)
This code build strings with + one char at a time, which is gonig to
be quadratic. You've already got a string in hand, so you can slice
it instead of building new strings:
var parts []string
last := 0
for i := 0; i < len(name); i++ {
if c == '.' {
parts = append(parts, name[last:i])
last = i+1
}
}
parts = append(parts, name[last:])
On 2012/05/22 03:21:10, rsc wrote: > LGTM > > Looks good except that Rietveld won't ...
12 years, 9 months ago
(2012-05-22 15:30:15 UTC)
#3
On 2012/05/22 03:21:10, rsc wrote:
> LGTM
>
> Looks good except that Rietveld won't show me side-by-side diffs, and also
> this:
>
> + // Split name into components.
> + s := ""
> + parts := make([]string, 0)
> + for _, c := range name {
> + if c == '.' {
> + parts = append(parts, s)
> + s = ""
> + } else {
> + s = s + string(c)
> + }
> + }
> + parts = append(parts, s)
>
> This code build strings with + one char at a time, which is gonig to
> be quadratic. You've already got a string in hand, so you can slice
> it instead of building new strings:
>
> var parts []string
> last := 0
> for i := 0; i < len(name); i++ {
> if c == '.' {
> parts = append(parts, name[last:i])
> last = i+1
> }
> }
> parts = append(parts, name[last:])
Good point - done.
*** Submitted as http://code.google.com/p/go/source/detail?r=ff109fe72249 *** syscall: implement nametomib() on netbsd Implement nametomib() on NetBSD using ...
12 years, 9 months ago
(2012-05-22 15:34:00 UTC)
#4
Issue 6211071: code review 6211071: syscall: implement nametomib() on netbsd
(Closed)
Created 12 years, 10 months ago by jsing
Modified 12 years, 9 months ago
Reviewers:
Base URL:
Comments: 0