Skip to content

Instantly share code, notes, and snippets.

@tvh
Last active August 29, 2015 14:09
Show Gist options
  • Save tvh/f939d90306e55145a7e8 to your computer and use it in GitHub Desktop.
Save tvh/f939d90306e55145a7e8 to your computer and use it in GitHub Desktop.
testzoo
set 100: 0.893666s
children: 14551
set 100: 0.894641s
children: 14451
set 100: 0.897937s
children: 14351
set 100: 0.903344s
children: 14251
delete 100: 0.903555s
delete 100: 0.903288s
children: 14151
delete 100: 0.903567s
delete 100: 0.903491s
set 100: 0.903628s
children: 14051
children: 13951
children: 13851
children: 13751
delete 100: 0.907248s
children: 13651
set 100: 0.911089s
delete 100: 0.911361s
set 100: 0.911259s
set 100: 0.911367s
children: 13551
delete 100: 0.911604s
delete 100: 0.911321s
delete 100: 0.911345s
children: 13451
set 100: 0.911995s
children: 13351
children: 13251
children: 13151
children: 13051
children: 12951
children: 12851
delete 100: 0.912696s
children: 12751
set 100: 0.920561s
children: 12651
insert 100: 1.893165s
insert 100: 1.906721s
insert 100: 1.913632s
insert 100: 1.913198s
set 100: 0.92007s
children: 12551
set 100: 0.924125s
children: 12451
insert 100: 1.919396s
insert 100: 1.917827s
delete 100: 0.922975s
children: 12351
set 100: 0.933258s
children: 12251
insert 100: 1.930553s
delete 100: 0.926617s
children: 12151
set 100: 0.931456s
children: 12051
set 100: 0.930737s
children: 11951
delete 100: 0.930903s
children: 11851
set 100: 0.92673s
children: 11751
insert 100: 1.941191s
delete 100: 0.938705s
children: 11651
delete 100: 0.930806s
children: 11551
set 100: 0.922213s
children: 11451
delete 100: 0.930123s
children: 11351
delete 100: 0.931511s
children: 11251
delete 100: 0.935251s
children: 11151
insert 100: 1.93497s
delete 100: 0.935631s
children: 11051
delete 100: 0.940555s
children: 10951
set 100: 0.939292s
children: 10851
set 100: 0.941288s
children: 10751
insert 100: 1.959252s
set 100: 0.943812s
children: 10651
set 100: 0.903551s
children: 10551
delete 100: 0.904853s
children: 10451
set 100: 0.913796s
children: 10351
set 100: 0.906474s
children: 10251
set 100: 0.913727s
children: 10151
delete 100: 0.918581s
children: 10051
delete 100: 0.905896s
children: 9951
set 100: 0.930831s
children: 9851
delete 100: 0.9065s
children: 9751
delete 100: 0.914301s
children: 9651
delete 100: 0.910001s
children: 9551
set 100: 0.914467s
children: 9451
set 100: 0.922326s
children: 9351
set 100: 0.911271s
children: 9251
delete 100: 0.921867s
children: 9151
delete 100: 0.922231s
children: 9051
delete 100: 0.925248s
children: 8951
set 100: 0.92167s
children: 8851
delete 100: 0.925425s
children: 8751
set 100: 0.9339s
children: 8651
insert 100: 1.802213s
insert 100: 1.824843s
set 100: 0.899237s
children: 14967
set 100: 0.919095s
children: 14867
set 100: 0.895501s
children: 14767
insert 100: 1.823724s
delete 100: 0.901308s
insert 100: 1.839658s
set 100: 0.909366s
delete 100: 0.900883s
children: 14667
delete 100: 0.918837s
children: 14567
children: 14467
delete 100: 0.901788s
children: 14367
children: 14267
set 100: 0.909396s
children: 14167
insert 100: 1.844727s
insert 100: 1.828624s
set 100: 0.906632s
children: 14067
delete 100: 0.910041s
children: 13967
set 100: 0.918312s
children: 13867
insert 100: 1.857161s
insert 100: 1.821465s
delete 100: 0.926765s
children: 13767
delete 100: 0.911023s
children: 13667
delete 100: 0.903539s
children: 13567
delete 100: 0.919873s
children: 13467
insert 100: 1.858478s
set 100: 0.92109s
set 100: 0.912452s
children: 13367
children: 13267
insert 100: 1.838603s
delete 100: 0.916323s
children: 13167
set 100: 0.915118s
children: 13067
delete 100: 0.860494s
children: 12967
delete 100: 0.860543s
children: 12867
set 100: 0.870647s
children: 12767
set 100: 0.865303s
children: 12667
set 100: 0.861985s
children: 12567
delete 100: 0.870199s
children: 12467
set 100: 0.875947s
children: 12367
delete 100: 0.874413s
children: 12267
set 100: 0.888546s
children: 12167
set 100: 0.867715s
children: 12067
delete 100: 0.866607s
children: 11967
delete 100: 0.881737s
children: 11867
set 100: 0.86678s
children: 11767
delete 100: 0.869163s
delete 100: 0.882763s
delete 100: 0.882747s
children: 11667
children: 11467
children: 11567
set 100: 0.883592s
children: 11367
set 100: 0.882221s
children: 11267
delete 100: 0.886728s
children: 11167
set 100: 0.879235s
children: 11067
insert 100: 1.747014s
insert 100: 1.741773s
insert 100: 1.779516s
delete 100: 0.889063s
children: 10967
insert 100: 1.787572s
delete 100: 0.892461s
children: 10867
delete 100: 0.910378s
children: 10767
set 100: 0.906345s
children: 10667
set 100: 0.914282s
children: 10567
set 100: 0.905904s
children: 10467
set 100: 0.912211s
children: 10367
set 100: 0.903214s
children: 10267
delete 100: 0.912821s
children: 10167
insert 100: 1.760805s
set 100: 0.906441s
children: 10067
insert 100: 1.784282s
insert 100: 1.767932s
insert 100: 1.768836s
delete 100: 0.897452s
children: 9967
delete 100: 0.914313s
children: 9867
set 100: 0.905216s
children: 9767
insert 100: 1.7953s
delete 100: 0.903421s
children: 9667
insert 100: 1.786784s
delete 100: 0.913945s
children: 9567
delete 100: 0.912233s
children: 9467
delete 100: 0.899214s
children: 9367
set 100: 0.903135s
children: 9267
set 100: 0.896032s
children: 9167
set 100: 0.921688s
children: 9067
delete 100: 0.925387s
children: 13514
delete 100: 0.915471s
children: 13414
set 100: 0.922267s
children: 13314
set 100: 0.920369s
children: 13214
set 100: 0.932197s
children: 13114
delete 100: 0.930041s
children: 13014
delete 100: 0.942463s
children: 12914
set 100: 0.928697s
children: 12814
set 100: 0.937572s
children: 12714
set 100: 0.972989s
children: 12614
delete 100: 0.941138s
children: 12514
delete 100: 0.934727s
children: 12414
delete 100: 0.946261s
children: 12314
set 100: 0.951859s
children: 12214
set 100: 0.935396s
children: 12114
delete 100: 0.948319s
children: 12014
delete 100: 0.950221s
children: 11914
set 100: 0.940497s
children: 11814
set 100: 0.950395s
children: 11714
delete 100: 0.966404s
children: 11614
insert 100: 1.840081s
insert 100: 1.87789s
delete 100: 0.952815s
children: 11514
insert 100: 1.851249s
delete 100: 0.955422s
children: 11414
set 100: 0.943705s
children: 11314
insert 100: 1.886146s
insert 100: 1.844074s
delete 100: 0.935746s
children: 11214
set 100: 0.946185s
children: 11114
set 100: 0.952402s
children: 11014
set 100: 0.936963s
children: 10914
delete 100: 0.946674s
children: 10814
insert 100: 1.927053s
set 100: 0.924216s
children: 10714
set 100: 0.949359s
children: 10614
delete 100: 0.929306s
delete 100: 0.935673s
children: 10514
children: 10414
delete 100: 0.937671s
children: 10314
set 100: 0.914749s
children: 10214
insert 100: 1.889906s
insert 100: 1.902035s
delete 100: 0.925203s
children: 10114
insert 100: 1.882101s
delete 100: 0.927366s
children: 10014
set 100: 0.937281s
children: 9914
delete 100: 0.924593s
children: 9814
set 100: 0.94385s
children: 9714
insert 100: 1.891267s
set 100: 0.93175s
children: 9614
delete 100: 0.948957s
children: 9514
set 100: 0.9468s
children: 9414
delete 100: 0.958823s
children: 9314
delete 100: 0.948638s
children: 9214
set 100: 0.944822s
children: 9114
set 100: 0.957617s
children: 9014
set 100: 0.960355s
children: 8914
delete 100: 0.933081s
children: 8814
delete 100: 0.933295s
delete 100: 0.931129s
children: 8714
children: 8614
delete 100: 0.959938s
children: 8514
set 100: 0.951586s
children: 8414
set 100: 0.956401s
children: 8314
delete 100: 0.950322s
children: 8214
set 100: 0.958662s
children: 8114
set 100: 0.946735s
children: 8014
delete 100: 0.950799s
children: 7914
set 100: 0.950996s
children: 7814
delete 100: 0.951392s
children: 7714
set 100: 0.961297s
children: 7614
set 100: 0.067966s
set 100: 0.093934s
set 100: 0.107512s
set 100: 0.071261s
delete 100: 0.082335s
delete 100: 0.072498s
children: 15060
set 100: 0.09788s
children: 14960
children: 14860
set 100: 0.083591s
delete 100: 0.092512s
children: 14760
children: 14660
children: 14560
children: 14460
children: 14360
children: 14260
delete 100: 0.07997s
insert 100: 0.15259s
insert 100: 0.242879s
set 100: 0.086428s
delete 100: 0.062893s
delete 100: 0.093004s
children: 14160
set 100: 0.056443s
delete 100: 0.070539s
delete 100: 0.07227s
children: 14060
children: 13960
children: 13860
children: 13760
insert 100: 0.172882s
delete 100: 0.112203s
children: 13660
set 100: 0.10535s
children: 13560
insert 100: 0.249852s
children: 13460
children: 13360
set 100: 0.106623s
children: 13260
insert 100: 0.194027s
insert 100: 0.190518s
delete 100: 0.115012s
children: 13160
delete 100: 0.076327s
children: 13060
set 100: 0.083541s
set 100: 0.088117s
delete 100: 0.079554s
children: 12960
set 100: 0.079954s
children: 12860
children: 12760
set 100: 0.082893s
children: 12660
set 100: 0.090351s
set 100: 0.093262s
delete 100: 0.084041s
children: 12360
children: 12560
children: 12460
set 100: 0.070274s
children: 12260
delete 100: 0.112378s
children: 12160
delete 100: 0.043812s
children: 12060
children: 11960
insert 100: 0.201308s
insert 100: 0.195331s
set 100: 0.084448s
children: 11860
delete 100: 0.054992s
children: 11760
delete 100: 0.079453s
children: 11660
delete 100: 0.084306s
children: 11560
delete 100: 0.106802s
children: 11460
delete 100: 0.075316s
children: 11360
insert 100: 0.178393s
set 100: 0.082773s
children: 11260
set 100: 0.094173s
children: 11160
delete 100: 0.060156s
children: 11060
set 100: 0.095074s
children: 10960
delete 100: 0.089195s
children: 10860
set 100: 0.071348s
children: 10760
set 100: 0.061876s
children: 10660
set 100: 0.084135s
children: 10560
set 100: 0.092029s
children: 10460
set 100: 0.054703s
children: 10360
delete 100: 0.137459s
children: 10260
delete 100: 0.064141s
children: 10160
delete 100: 0.040852s
children: 10060
insert 100: 0.248048s
delete 100: 0.061037s
children: 9960
set 100: 0.0362s
children: 9860
set 100: 0.04745s
children: 9760
set 100: 0.083938s
children: 9660
delete 100: 0.100766s
delete 100: 0.0781s
children: 9560
children: 9460
insert 100: 0.176904s
insert 100: 0.093154s
set 100: 0.118632s
set 100: 0.046517s
insert 100: 0.146733s
children: 9360
set 100: 0.05497s
children: 9260
delete 100: 0.061608s
children: 9160
children: 9060
delete 100: 0.086449s
children: 8960
insert 100: 0.164172s
set 100: 0.069959s
set 100: 0.07265s
delete 100: 0.069569s
children: 8860
children: 8760
children: 8660
set 100: 0.082175s
children: 8560
insert 100: 0.227597s
delete 100: 0.08816s
children: 8460
delete 100: 0.072754s
children: 8360
set 100: 0.091636s
children: 8260
set 100: 0.050877s
children: 8160
set 100: 0.063889s
children: 8060
delete 100: 0.123563s
children: 7960
delete 100: 0.071112s
children: 7860
delete 100: 0.095261s
children: 7760
set 100: 0.063428s
children: 7660
insert 100: 0.210532s
set 100: 0.047386s
children: 7560
delete 100: 0.068002s
children: 7460
set 100: 0.052025s
children: 7360
delete 100: 0.040176s
children: 7260
set 100: 0.040789s
children: 7160
delete 100: 0.066318s
set 100: 0.066063s
children: 7060
children: 6960
set 100: 0.053644s
set 100: 0.043163s
children: 6860
children: 6760
set 100: 0.051644s
children: 6660
delete 100: 0.055008s
children: 6560
delete 100: 0.0479s
children: 6460
insert 100: 0.253834s
delete 100: 0.067226s
children: 6360
delete 100: 0.086081s
children: 6260
set 100: 0.048917s
children: 6160
insert 100: 0.17451s
delete 100: 0.121407s
children: 6060
set 100: 0.076363s
children: 5960
set 100: 0.089257s
children: 5860
delete 100: 0.083105s
children: 5760
delete 100: 0.093732s
children: 5660
set 100: 0.077888s
children: 5560
set 100: 0.075328s
children: 5460
delete 100: 0.077841s
children: 5360
delete 100: 0.074979s
children: 5260
set 100: 0.069579s
children: 5160
set 100: 0.132424s
children: 5060
set 100: 0.084364s
children: 4960
delete 100: 0.061451s
children: 4860
set 100: 0.084384s
children: 4760
delete 100: 0.079851s
children: 4660
set 100: 0.063334s
children: 4560
insert 100: 0.20504s
insert 100: 0.176473s
delete 100: 0.081959s
children: 4460
insert 100: 0.273564s
delete 100: 0.069478s
children: 4360
delete 100: 0.123464s
children: 4260
set 100: 0.065467s
children: 4160
set 100: 0.062389s
children: 4060
set 100: 0.078685s
children: 3960
set 100: 0.121296s
children: 3860
delete 100: 0.053632s
children: 3760
delete 100: 0.081s
children: 3660
set 100: 0.076459s
children: 3560
insert 100: 0.187317s
insert 100: 0.223646s
delete 100: 0.058606s
children: 3460
delete 100: 0.08754s
children: 3360
insert 100: 0.215294s
set 100: 0.066434s
children: 3260
set 100: 0.06454s
children: 3160
insert 100: 0.173826s
delete 100: 0.054478s
children: 3060
set 100: 0.059895s
children: 2960
set 100: 0.062754s
children: 2860
set 100: 0.082847s
delete 100: 0.141665s
children: 2760
children: 2660
delete 100: 0.055205s
children: 2560
delete 100: 0.105873s
children: 2460
set 100: 0.048851s
insert 100: 0.145118s
children: 2360
delete 100: 0.049143s
children: 2260
insert 100: 0.158956s
set 100: 0.065556s
children: 2160
delete 100: 0.083896s
children: 2060
set 100: 0.059401s
children: 1960
delete 100: 0.097764s
children: 1860
set 100: 0.067762s
children: 1760
delete 100: 0.063338s
children: 1660
set 100: 0.050953s
children: 1560
delete 100: 0.056536s
children: 1460
insert 100: 0.257961s
set 100: 0.056366s
children: 1360
delete 100: 0.068828s
children: 1260
set 100: 0.059113s
children: 1160
set 100: 0.080073s
children: 1060
delete 100: 0.063658s
children: 960
delete 100: 0.050989s
children: 860
insert 100: 0.128002s
insert 100: 0.135649s
set 100: 0.068182s
set 100: 0.08644s
children: 760
children: 660
set 100: 0.063494s
children: 560
delete 100: 0.067985s
children: 460
set 100: 0.061767s
children: 360
delete 100: 0.088404s
children: 260
delete 100: 0.054056s
children: 160
delete 100: 0.061812s
children: 60
set 100: 0.071353s
delete 100: 0.062407s
delete 100: 0.093878s
set 100: 0.068699s
set 100: 0.078269s
set 100: 0.074805s
delete 100: 0.081538s
set 100: 0.111859s
set 100: 0.078252s
set 100: 0.09409s
delete 100: 0.059288s
delete 100: 0.096828s
delete 100: 0.068906s
delete 100: 0.102039s
delete 100: 0.070937s
delete 100: 0.071492s
set 100: 0.091593s
set 100: 0.088283s
delete 100: 0.146612s
set 100: 0.097436s
children: 17481
children: 17481
children: 17381
children: 17281
children: 17181
children: 17081
children: 16981
children: 16881
children: 16781
children: 16681
children: 16581
children: 16481
children: 16381
children: 16281
children: 16181
children: 16081
children: 15981
children: 15881
children: 15781
children: 15681
children: 15581
insert 100: 0.250822s
insert 100: 0.341196s
insert 100: 0.295453s
insert 100: 0.300293s
set 100: 0.052077s
delete 100: 0.054191s
children: 15481
children: 15381
insert 100: 0.270849s
delete 100: 0.066181s
children: 15281
delete 100: 0.067601s
children: 15181
set 100: 0.069693s
children: 15081
delete 100: 0.07144s
children: 14981
delete 100: 0.073321s
children: 14881
delete 100: 0.072938s
children: 14781
set 100: 0.082945s
children: 14681
delete 100: 0.084525s
children: 14581
delete 100: 0.0824s
set 100: 0.084868s
children: 14481
insert 100: 0.323913s
set 100: 0.087083s
children: 14381
set 100: 0.091782s
insert 100: 0.260691s
set 100: 0.093754s
delete 100: 0.095469s
children: 14281
children: 14181
children: 14081
children: 13981
set 100: 0.100609s
children: 13881
delete 100: 0.100732s
children: 13781
set 100: 0.102221s
children: 13681
insert 100: 0.286051s
set 100: 0.057514s
children: 13581
delete 100: 0.064862s
children: 13481
insert 100: 0.332048s
delete 100: 0.060506s
children: 13381
insert 100: 0.304478s
delete 100: 0.075829s
children: 13281
delete 100: 0.086311s
children: 13181
set 100: 0.154912s
children: 13081
set 100: 0.065844s
children: 12981
set 100: 0.066272s
children: 12881
delete 100: 0.093518s
children: 12781
delete 100: 0.092812s
children: 12681
delete 100: 0.086144s
children: 12581
set 100: 0.104557s
children: 12481
set 100: 0.089527s
children: 12381
set 100: 0.097333s
children: 12281
delete 100: 0.105831s
children: 12181
delete 100: 0.067175s
children: 12081
set 100: 0.084261s
delete 100: 0.07679s
delete 100: 0.097215s
children: 11981
children: 11881
children: 11781
set 100: 0.10478s
children: 11681
delete 100: 0.110494s
children: 11581
set 100: 0.050447s
children: 11481
delete 100: 0.053267s
children: 11381
insert 100: 0.165816s
delete 100: 0.070315s
children: 11281
set 100: 0.04869s
children: 11181
delete 100: 0.060007s
children: 11081
insert 100: 0.209927s
delete 100: 0.037819s
children: 10981
insert 100: 0.17367s
insert 100: 0.13835s
set 100: 0.08673s
children: 10881
set 100: 0.142881s
children: 10781
set 100: 0.081115s
children: 10681
delete 100: 0.057405s
children: 10581
set 100: 0.074464s
children: 10481
insert 100: 0.151779s
set 100: 0.158079s
children: 10381
insert 100: 0.108538s
insert 100: 0.207018s
delete 100: 0.056433s
children: 10281
insert 100: 0.196794s
set 100: 0.086115s
children: 10181
delete 100: 0.048977s
children: 10081
set 100: 0.069306s
children: 9981
delete 100: 0.125079s
children: 9881
delete 100: 0.080305s
children: 9781
set 100: 0.059022s
children: 9681
delete 100: 0.057976s
children: 9581
delete 100: 0.080136s
children: 9481
set 100: 0.081387s
children: 9381
delete 100: 0.119682s
children: 9281
set 100: 0.080919s
children: 9181
insert 100: 0.177882s
set 100: 0.064969s
children: 9081
delete 100: 0.085214s
children: 8981
set 100: 0.073846s
delete 100: 0.051823s
insert 100: 0.224253s
children: 8881
children: 8781
set 100: 0.071933s
children: 8681
set 100: 0.067302s
children: 8581
delete 100: 0.044209s
children: 8481
set 100: 0.089565s
children: 8381
delete 100: 0.079593s
children: 8281
delete 100: 0.053241s
children: 8181
delete 100: 0.117077s
children: 8081
set 100: 0.057139s
children: 7981
delete 100: 0.074869s
children: 7881
set 100: 0.086852s
children: 7781
insert 100: 0.131196s
set 100: 0.054566s
children: 7681
delete 100: 0.074429s
children: 7581
set 100: 0.079704s
children: 7481
delete 100: 0.058407s
children: 7381
insert 100: 0.144555s
delete 100: 0.124187s
delete 100: 0.055391s
delete 100: 0.038628s
children: 7281
children: 7181
children: 7081
set 100: 0.12785s
children: 6981
insert 100: 0.126547s
set 100: 0.091072s
children: 6881
set 100: 0.058014s
delete 100: 0.106123s
children: 6781
children: 6681
insert 100: 0.156989s
set 100: 0.072799s
children: 6581
insert 100: 0.140007s
set 100: 0.061335s
children: 6481
set 100: 0.084924s
insert 100: 0.152541s
delete 100: 0.074521s
children: 6381
children: 6281
insert 100: 0.157287s
delete 100: 0.086613s
children: 6181
delete 100: 0.059767s
children: 6081
set 100: 0.084716s
children: 5981
delete 100: 0.077687s
children: 5881
set 100: 0.070315s
children: 5781
delete 100: 0.088988s
children: 5681
delete 100: 0.047733s
children: 5581
set 100: 0.06542s
children: 5481
insert 100: 0.216936s
delete 100: 0.073003s
children: 5381
set 100: 0.095847s
children: 5281
set 100: 0.073778s
children: 5181
delete 100: 0.099892s
children: 5081
delete 100: 0.07995s
set 100: 0.077584s
children: 4981
children: 4881
set 100: 0.047618s
children: 4781
delete 100: 0.062549s
children: 4681
set 100: 0.105829s
children: 4581
insert 100: 0.187862s
delete 100: 0.111805s
delete 100: 0.079754s
children: 4481
delete 100: 0.064178s
children: 4381
children: 4281
set 100: 0.133691s
children: 4181
delete 100: 0.107841s
children: 4081
set 100: 0.129845s
children: 3981
set 100: 0.105282s
children: 3881
delete 100: 0.106017s
children: 3781
set 100: 0.101367s
children: 3681
set 100: 0.124186s
children: 3581
set 100: 0.087749s
children: 3481
set 100: 0.074008s
children: 3381
insert 100: 0.152363s
delete 100: 0.079547s
children: 3281
delete 100: 0.08186s
children: 3181
delete 100: 0.098924s
set 100: 0.08522s
set 100: 0.083817s
delete 100: 0.131696s
children: 3081
children: 2981
children: 2881
children: 2781
insert 100: 0.249109s
insert 100: 0.201985s
insert 100: 0.184314s
set 100: 0.047717s
children: 2681
delete 100: 0.094495s
children: 2581
delete 100: 0.069028s
children: 2481
set 100: 0.098371s
children: 2381
set 100: 0.068389s
children: 2281
set 100: 0.056989s
children: 2181
delete 100: 0.081054s
children: 2081
insert 100: 0.242699s
delete 100: 0.052608s
children: 1981
delete 100: 0.069824s
children: 1881
delete 100: 0.038088s
children: 1781
delete 100: 0.094066s
children: 1681
delete 100: 0.089664s
children: 1581
set 100: 0.06787s
children: 1481
set 100: 0.071385s
children: 1381
set 100: 0.08389s
insert 100: 0.208464s
children: 1281
insert 100: 0.220938s
delete 100: 0.073882s
children: 1181
set 100: 0.06173s
children: 1081
set 100: 0.119398s
set 100: 0.071412s
children: 981
children: 881
set 100: 0.088871s
children: 781
insert 100: 0.281448s
delete 100: 0.114352s
children: 681
delete 100: 0.062197s
children: 581
set 100: 0.08295s
children: 481
delete 100: 0.066896s
set 100: 0.060624s
set 100: 0.1104s
children: 381
delete 100: 0.078462s
children: 281
children: 181
children: 81
delete 100: 0.073777s
delete 100: 0.103189s
set 100: 0.101808s
delete 100: 0.08351s
delete 100: 0.09753s
delete 100: 0.093718s
set 100: 0.127371s
set 100: 0.102436s
set 100: 0.103028s
delete 100: 0.182715s
set 100: 0.133621s
delete 100: 0.111397s
set 100: 0.115581s
delete 100: 0.12212s
set 100: 0.119498s
delete 100: 0.126666s
set 100: 0.155748s
set 100: 0.149665s
delete 100: 0.191197s
set 100: 0.242716s
children: 12190
children: 12190
children: 12090
children: 11990
children: 11890
children: 11790
children: 11690
children: 11590
children: 11490
children: 11390
children: 11290
children: 11190
children: 11090
children: 10990
children: 10890
children: 10790
children: 10690
children: 10590
children: 10490
children: 10390
children: 10290
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Data.Foldable
import Control.Monad (forever,void,when,replicateM)
import Database.Zookeeper
import Control.Concurrent
import System.Random
import Control.Concurrent.STM
import qualified Data.Sequence as S
import Data.Time.Clock
maxn = 300000
url = "192.168.2.4:2181"
insertThread :: TMVar (S.Seq String) -> IO ()
insertThread tchan = do
withZookeeper url 1000 Nothing Nothing $ \zk -> forever $ do
t1 <- getCurrentTime
replicateM 100 $ do
n <- randomIO :: IO Int
let node = "/node" ++ show n
atomically $ do
n <- readTMVar tchan
when (S.length n > maxn) retry
ex <- exists zk node Nothing
case ex of
Left NoNodeError -> do
Right _ <- create zk node (Just "bla") OpenAclUnsafe [Sequence]
return ()
Right _ -> do
Right _ <- set zk node (Just "foo") Nothing
return ()
t2 <- getCurrentTime
putStrLn $ "insert 100: " ++ (show $ diffUTCTime t2 t1)
setThread :: TMVar (S.Seq String) -> IO ()
setThread tchan = do
withZookeeper url 1000 Nothing Nothing $ \zk -> forever $ do
childs <- atomically $ do
chan <- takeTMVar tchan
if (not . S.null $ chan)
then let (xs,ys) = S.splitAt 100 chan in putTMVar tchan ys >> return (Just (S.length chan, xs))
else return Nothing
case childs of
Just (n,children) -> do
t1 <- getCurrentTime
putStrLn $ "children: " ++ show n
forM_ children $ \child -> set zk ("/" ++ child) (Just "boo") Nothing
t2 <- getCurrentTime
putStrLn $ "set 100: " ++ (show $ diffUTCTime t2 t1)
Nothing -> do
Right children' <- getChildren zk "/" Nothing
putStrLn $ "children: " ++ show (length children')
atomically $ putTMVar tchan (S.fromList children')
deleteThread :: TMVar (S.Seq String) -> IO ()
deleteThread tchan = do
withZookeeper url 1000 Nothing Nothing $ \zk -> forever $ do
childs <- atomically $ do
chan <- takeTMVar tchan
if (not . S.null $ chan)
then let (xs,ys) = S.splitAt 100 chan in putTMVar tchan ys >> return (Just (S.length chan, xs))
else return Nothing
case childs of
Just (n,children) -> do
t1 <- getCurrentTime
putStrLn $ "children: " ++ show n
forM_ children $ \child -> delete zk ("/" ++ child) Nothing
t2 <- getCurrentTime
putStrLn $ "delete 100: " ++ (show $ diffUTCTime t2 t1)
Nothing -> do
Right children' <- getChildren zk "/" Nothing
putStrLn $ "children: " ++ show (length children')
atomically $ putTMVar tchan (S.fromList children')
printThread :: TMVar (S.Seq String) -> IO ()
printThread tchan = do
withZookeeper url 1000 Nothing Nothing $ \zk -> forever $ do
threadDelay $ 3*10^6
Right children' <- getChildren zk "/" Nothing
atomically $ do
void $ takeTMVar tchan
putTMVar tchan (S.fromList children')
main :: IO ()
main = do
chan <- newTMVarIO S.empty
replicateM 10 $ void $ forkIO $ insertThread chan
replicateM 10 $ void $ forkIO $ setThread chan
replicateM 10 $ void $ forkIO $ deleteThread chan
printThread chan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment