performance: gjson parsing for readXLMeta, listParts, getObjectInfo. (#2631)

- Using gjson for constructing xlMetaV1{} in realXLMeta.
- Test for parsing constructing xlMetaV1{} using gjson.
- Changes made since benchmarks showed 30-40% improvement in speed.
- Follow up comments in issue https://github.com/minio/minio/issues/2208
  for more details.
- gjson parsing of parts from xl.json for listParts.
- gjson parsing of statInfo from xl.json for getObjectInfo.
- Vendorizing gjson dependency.
This commit is contained in:
Karthic Rao
2016-09-09 11:08:18 +05:30
committed by Harshavardhana
parent 66459a4ce0
commit 8bd78fbdfb
15 changed files with 2249 additions and 38 deletions
+4 -3
View File
@@ -55,13 +55,14 @@ func TestAddObjectPart(t *testing.T) {
xlMeta.AddObjectPart(testCase.partNum, "part."+partNumString, "etag."+partNumString, int64(testCase.partNum+MiB))
}
if index := xlMeta.ObjectPartIndex(testCase.partNum); index != testCase.expectedIndex {
if index := objectPartIndex(xlMeta.Parts, testCase.partNum); index != testCase.expectedIndex {
t.Fatalf("%+v: expected = %d, got: %d", testCase, testCase.expectedIndex, index)
}
}
}
// Test xlMetaV1.ObjectPartIndex()
// Test objectPartIndex().
// generates a sample xlMeta data and asserts the output of objectPartIndex() with the expected value.
func TestObjectPartIndex(t *testing.T) {
testCases := []struct {
partNum int
@@ -94,7 +95,7 @@ func TestObjectPartIndex(t *testing.T) {
// Test them.
for _, testCase := range testCases {
if index := xlMeta.ObjectPartIndex(testCase.partNum); index != testCase.expectedIndex {
if index := objectPartIndex(xlMeta.Parts, testCase.partNum); index != testCase.expectedIndex {
t.Fatalf("%+v: expected = %d, got: %d", testCase, testCase.expectedIndex, index)
}
}