encoding/json: improve performance of Unmarshal on primitive types
encoding/json: improve performance of Unmarshal on primitive types

Attempt 2. The first fix was much faster but ignored syntax errors.

benchmark                      old ns/op    new ns/op    delta
BenchmarkCodeEncoder            74993543     72982390   -2.68%
BenchmarkCodeMarshal            77811181     75610637   -2.83%
BenchmarkCodeDecoder           213337123    190144982  -10.87%
BenchmarkCodeUnmarshal         212180972    190394852  -10.27%
BenchmarkCodeUnmarshalReuse    202113428    182106660   -9.90%
BenchmarkUnmarshalString            1343          919  -31.57%
BenchmarkUnmarshalFloat64           1149          908  -20.97%
BenchmarkUnmarshalInt64              967          778  -19.54%
BenchmarkSkipValue              28851581     28414125   -1.52%

benchmark                       old MB/s     new MB/s  speedup
BenchmarkCodeEncoder               25.88        26.59    1.03x
BenchmarkCodeMarshal               24.94        25.66    1.03x
BenchmarkCodeDecoder                9.10        10.21    1.12x
BenchmarkCodeUnmarshal              9.15        10.19    1.11x
BenchmarkSkipValue                 69.05        70.11    1.02x

Fixes issue 3949.

R=rsc
CC=golang-dev
https://codereview.appspot.com/7231058

Committer: Russ Cox <5ad239cb8a44f659eaaee0aa1ea5b94947abe557@golang.org>

sanjosh/sanjos100-tipc,mhennings/marcohennings-go,glycerine/jeaten-go-arrayof-structof,sanjosh/sanjos100-tipc,webfd/go-zh,glycerine/jeaten-go-arrayof-structof,scirelli/scirelli-go,d0f/go-zh,d0f/go-zh,bryanxu/go-zh,mhennings/marcohennings-go,rdp/rogerpack2005-golang,webfd/go-zh,glycerine/jeaten-go-arrayof-structof,bryanxu/go-zh,rdp/rogerpack2005-golang,webfd/go-zh,mhennings/marcohennings-go,bryanxu/go-zh,mhennings/marcohennings-go,rdp/rogerpack2005-golang,scirelli/scirelli-go,scirelli/scirelli-go,scirelli/scirelli-go,rdp/rogerpack2005-golang,bryanxu/go-zh,rdp/rogerpack2005-golang,glycerine/jeaten-go-arrayof-structof,sanjosh/sanjos100-tipc,d0f/go-zh,rdp/rogerpack2005-golang,d0f/go-zh,d0f/go-zh,webfd/go-zh,sanjosh/sanjos100-tipc,glycerine/jeaten-go-arrayof-structof,webfd/go-zh,bryanxu/go-zh,sanjosh/sanjos100-tipc,rdp/rogerpack2005-golang,webfd/go-zh,webfd/go-zh,webfd/go-zh,glycerine/jeaten-go-arrayof-structof,mhennings/marcohennings-go,sanjosh/sanjos100-tipc,sanjosh/sanjos100-tipc,bryanxu/go-zh,d0f/go-zh,glycerine/jeaten-go-arrayof-structof,bryanxu/go-zh,scirelli/scirelli-go,rdp/rogerpack2005-golang,bryanxu/go-zh,scirelli/scirelli-go,glycerine/jeaten-go-arrayof-structof,sanjosh/sanjos100-tipc,scirelli/scirelli-go,d0f/go-zh,mhennings/marcohennings-go,scirelli/scirelli-go,d0f/go-zh,mhennings/marcohennings-go,mhennings/marcohennings-go