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,12 +4,12 @@ package seccomp
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"github.com/containerd/containerd/containers"
"github.com/containerd/containerd/oci"
jsoniter "github.com/json-iterator/go"
"github.com/opencontainers/runtime-spec/specs-go"
)
@@ -23,6 +23,7 @@ func WithProfile(profile string) oci.SpecOpts {
if err != nil {
return fmt.Errorf("Cannot load seccomp profile %q: %v", profile, err)
}
json := jsoniter.ConfigCompatibleWithStandardLibrary
if err := json.Unmarshal(f, s.Linux.Seccomp); err != nil {
return fmt.Errorf("Decoding seccomp profile failed %q: %v", profile, err)
}