mirror of
https://github.com/pgsty/minio.git
synced 2026-08-09 07:43:29 +03:00
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:
committed by
Harshavardhana
parent
66459a4ce0
commit
8bd78fbdfb
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user