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

@@ -1,11 +1,11 @@
package mount
import (
"encoding/json"
"path/filepath"
"strings"
"github.com/Microsoft/hcsshim"
jsoniter "github.com/json-iterator/go"
"github.com/pkg/errors"
)
@@ -49,6 +49,7 @@ const ParentLayerPathsFlag = "parentLayerPaths="
// GetParentPaths of the mount
func (m *Mount) GetParentPaths() ([]string, error) {
var parentLayerPaths []string
json := jsoniter.ConfigCompatibleWithStandardLibrary
for _, option := range m.Options {
if strings.HasPrefix(option, ParentLayerPathsFlag) {
err := json.Unmarshal([]byte(option[len(ParentLayerPathsFlag):]), &parentLayerPaths)