Use jsoniteer for faster json encoding/decoding

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2018-01-26 16:31:54 -05:00
parent 43a9473a53
commit 4233b87b89
11 changed files with 33 additions and 11 deletions

View File

@@ -4,7 +4,6 @@ package containerd
import (
"context"
"encoding/json"
"fmt"
"os"
"path/filepath"
@@ -20,6 +19,7 @@ import (
"github.com/containerd/containerd/platforms"
"github.com/gogo/protobuf/proto"
protobuf "github.com/gogo/protobuf/types"
jsoniter "github.com/json-iterator/go"
digest "github.com/opencontainers/go-digest"
"github.com/opencontainers/image-spec/identity"
"github.com/opencontainers/image-spec/specs-go/v1"
@@ -121,6 +121,7 @@ func decodeIndex(ctx context.Context, store content.Store, id digest.Digest) (*v
if err != nil {
return nil, err
}
json := jsoniter.ConfigCompatibleWithStandardLibrary
if err := json.Unmarshal(p, &index); err != nil {
return nil, err
}