Descriptionnet: avoid string operation and make valid domain names explicit
Having a trailing dot in the string doesn't really simplify
the checking loop in isDomainName. Avoid this unnecessary allocation.
Also make the valid domain names more explicit by adding some more
test cases.
benchmark old ns/op new ns/op delta
BenchmarkDNSNames 2420.0 983.0 -59.38%
benchmark old allocs new allocs delta
BenchmarkDNSNames 12 0 -100.00%
benchmark old bytes new bytes delta
BenchmarkDNSNames 336 0 -100.00%
Patch Set 1 #Patch Set 2 : diff -r 2a74ed09bf00 https://code.google.com/p/go/ #Patch Set 3 : diff -r 2a74ed09bf00 https://code.google.com/p/go/ #
Total comments: 10
Patch Set 4 : diff -r b0240b16a8e0 https://code.google.com/p/go/ #
Total comments: 2
Patch Set 5 : diff -r b0240b16a8e0 https://code.google.com/p/go/ #MessagesTotal messages: 8
|