From fbc44d8f957e1f73a7ee014a8445f0fc8bf34585 Mon Sep 17 00:00:00 2001 From: beorn7 Date: Thu, 19 Mar 2015 19:28:21 +0100 Subject: [PATCH] Add benchmark for loading chunks and chunk descs. --- storage/local/fixtures/b0/04b821ca50ba26.db | Bin 0 -> 62460 bytes storage/local/fixtures/b0/37c21e884e4fc5.db | Bin 0 -> 48927 bytes storage/local/fixtures/b0/37de1e884e5469.db | Bin 0 -> 51009 bytes storage/local/persistence_test.go | 71 ++++++++++++++++++++ 4 files changed, 71 insertions(+) create mode 100644 storage/local/fixtures/b0/04b821ca50ba26.db create mode 100644 storage/local/fixtures/b0/37c21e884e4fc5.db create mode 100644 storage/local/fixtures/b0/37de1e884e5469.db diff --git a/storage/local/fixtures/b0/04b821ca50ba26.db b/storage/local/fixtures/b0/04b821ca50ba26.db new file mode 100644 index 0000000000000000000000000000000000000000..a9be8736432a15b8e92cad9e5451ceff7f745195 GIT binary patch literal 62460 zcmeI5d2Ccw6vk&-loEs#tDzyFEJ8{OQZ`u(n?x)^!(xDHRf-6*Xj%nAv0#y4K-5^H z5Ks|}5P^iIA|Mcgl?W+|r2&Ek5fBin5G?zMRBYejJ9m-^lL0G+o{vA6ujk!)Gwqie+YP^_p|{0ZcgMti}BpDTa5)tueEyFPd79g_cx z_Z)oA;CwshB=~i2lyCHYg2xAs39kQ}9LYIvG$xYz&5j8k|9|D+`MlZp5Xo~ZZ|n14 z2?)LzzQY5;m1uvA4@KPcAwa+Zy|p!5yYV3%6G^D5^Mt-uBxjCfjGj5nU_GQkpA{M+ z858DNVV-_#heBVgsw!dLPv}d8863%>Fk?brD@;Ytqal*PVaD9rq0m>?iUvKiRzic0 zalvc){y8HB1Z&Rk^nmbZbX1HFMcmvWKnOYu#`q(wIkyP^40m)w9lQopAcu3nIjFSu zs@?}44k~WWg_i{cDNBo-A)tsGF$4%W;2^+CAcwP2u~9h*cj_dFA#_|WAZR{ymj{HX zsEUsaDB>%D>x7H7bp-MrWXL5H-x-lO-W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|sn#ApR<=S%`Y zRl;?h5ZE*&A@KLag=fSUo+w?+{Do+RIJ>+nfndze8yW~~@@#WL;K$fF*f{>>6Ek}O z3)?r91cdax1Om@|tH1xhbW{I?8k<}v00B1@vHjJCiD3p35ZsFh1SNeO8VGCx2*^T+ z0sf5=!yMpEu6SVC(^ClqiFe+ifbfw2rXrhaj4K~E6{%SGi3-Ge1#D+LfuQQEb~+)j z$?(7>11=fN=#sqRO-zQ0b$0ny0>PNP_8JIma(Ms*00BTy8zzRY9S8{N1q1?5;$0dD zYyt=-b_$+#e0L*m9msSO5Zn(E2ucpbYap=6W04S$5ReeeNC?yG2n3y%+@pcOCV+r0 zX;zoy6>s9aQ$nzo5eO>NI%y!V$>l*pKte!5Fe4$94I&U^oVr&7flUCx#7@Dpj_+<( zI--P-dYV9RtSmtTflXc-NC-#>NC;*mgxZw^g2E^6(?DPoKtPu?t4s2VH*wx6A>=+q zAc()#MFW9NE)Nm{5&{x}841DLL?Bqbwwne5n*f4|oq}f_-`%WqL3JHUR{5Nwc~nuXq#ZT>P literal 0 HcmV?d00001 diff --git a/storage/local/fixtures/b0/37de1e884e5469.db b/storage/local/fixtures/b0/37de1e884e5469.db new file mode 100644 index 0000000000000000000000000000000000000000..3445e010911beb8018c3f9e1adb801eb5abc62b6 GIT binary patch literal 51009 zcmeI5du)?c7{>c`7^(WA`XX;FocDH0ZNEEl*z>aGgCK2U?67GK^P3!BqS_| zamGj%MVWC%Fo6sN9A@euLdLy8GRH+gM5sb=T!hMPw&&gZo`z<%#ffRp!yoI@r|0|H zzUQ3Z`+Of^SQC0Jd2FO*v$a{XT|HipYvr)9>GOSmyhWZkC2aiM|Lj(E;gBJ6?7S$^ z|HWqxJZGT3oiz!3-{y34pC@p9;Fv)F-{^48+1!|L{7A-_{q_ z5(qxc+NpqWCC+l#*yK$g1O$FTwzi1I=3kOA;fO{;&{P*a+FDM8bLMcy$Oj8CSY8q# zM+J*;#)LR3#NoI0Qt*4VloR6f1iwXy!Qs3VV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2Qu9R1oy)Pg5rJg8VGFiSR@1_1SAAA5<*TLfuQ4}`!o>P1Q5_A z&FYf8;!T`)N(iW+a5NfdqoIQ}=5iun8cT*eQ6{@!icz zN0bnfPZJ1^l_h8(u*pjU2>}TK3BinnP`jK!Q1J8v8VGCx29@Ic! zla~e(0ullef*A=RX%c~;KHjN;z$SozE@@VmMxjaY+NC-#>W+a5Fr38YUL62%6 Uun8cT*eQ6{@!iczM+$g<1Ej{ExBvhE literal 0 HcmV?d00001 diff --git a/storage/local/persistence_test.go b/storage/local/persistence_test.go index 2edc7d829..d6b75d2ee 100644 --- a/storage/local/persistence_test.go +++ b/storage/local/persistence_test.go @@ -884,3 +884,74 @@ func verifyIndexedState(i int, t *testing.T, b incrementalBatch, indexedFpsToMet } } } + +var fpStrings = []string{ + "b004b821ca50ba26", + "b037c21e884e4fc5", + "b037de1e884e5469", +} + +func BenchmarkLoadChunksSequentially(b *testing.B) { + p := persistence{ + basePath: "fixtures", + } + sequentialIndexes := make([]int, 47) + for i := range sequentialIndexes { + sequentialIndexes[i] = i + } + + var fp clientmodel.Fingerprint + for i := 0; i < b.N; i++ { + for _, s := range fpStrings { + fp.LoadFromString(s) + cds, err := p.loadChunks(fp, sequentialIndexes, 0) + if err != nil { + b.Error(err) + } + if len(cds) == 0 { + b.Error("could not read any chunks") + } + } + } +} + +func BenchmarkLoadChunksRandomly(b *testing.B) { + p := persistence{ + basePath: "fixtures", + } + randomIndexes := []int{1, 5, 6, 8, 11, 14, 18, 23, 29, 33, 42, 46} + + var fp clientmodel.Fingerprint + for i := 0; i < b.N; i++ { + for _, s := range fpStrings { + fp.LoadFromString(s) + cds, err := p.loadChunks(fp, randomIndexes, 0) + if err != nil { + b.Error(err) + } + if len(cds) == 0 { + b.Error("could not read any chunks") + } + } + } +} + +func BenchmarkLoadChunkDescs(b *testing.B) { + p := persistence{ + basePath: "fixtures", + } + + var fp clientmodel.Fingerprint + for i := 0; i < b.N; i++ { + for _, s := range fpStrings { + fp.LoadFromString(s) + cds, err := p.loadChunkDescs(fp, clientmodel.Latest) + if err != nil { + b.Error(err) + } + if len(cds) == 0 { + b.Error("could not read any chunk descs") + } + } + } +}