Removed resource file with hardcoded docIds

This commit is contained in:
expani 2024-10-15 17:57:07 +05:30
parent 68d0bbff0c
commit 33232e57c8
3 changed files with 56 additions and 58 deletions

View File

@ -29,6 +29,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Random;
import java.util.Scanner;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@ -437,6 +438,15 @@ public class DocIdEncodingBenchmark {
}
interface DocIdProvider {
Map<Class<? extends DocIdEncodingBenchmark.DocIdEncoder>, Integer> ENCODER_TO_BPV_MAPPING =
Map.of(
DocIdEncodingBenchmark.DocIdEncoder.Bit21With2StepsEncoder.class, 21,
DocIdEncodingBenchmark.DocIdEncoder.Bit21With3StepsEncoder.class, 21,
DocIdEncodingBenchmark.DocIdEncoder.Bit21HybridEncoder.class, 21,
DocIdEncodingBenchmark.DocIdEncoder.Bit24Encoder.class, 24,
DocIdEncodingBenchmark.DocIdEncoder.Bit32Encoder.class, 32);
/**
* We want to load all the docId sequences completely in memory to avoid including the time
* spent in fetching from disk in every iteration unless we can consistently prove otherwise.
@ -471,6 +481,32 @@ public class DocIdEncodingBenchmark {
}
}
static class FixedBPVRandomDocIdProvider implements DocIdEncodingBenchmark.DocIdProvider {
private final Random random = new Random();
@Override
public List<int[]> getDocIds(Object... args) {
Class<? extends DocIdEncoder> encoderClass = (Class<? extends DocIdEncoder>) args[0];
int capacity = (int) args[1];
int low = (int) args[2];
int high = (int) args[3];
List<int[]> docIdSequences = new ArrayList<>(capacity);
for (int i = 1; i <= capacity; i++) {
docIdSequences.add(
random
.ints(0, (int) Math.pow(2, ENCODER_TO_BPV_MAPPING.get(encoderClass)) - 1)
.distinct()
.limit(random.nextInt(low, high))
.toArray());
}
return docIdSequences;
}
}
private static void parseInput() {
String inputScaleFactor = System.getProperty("docIdEncoding.inputScaleFactor");
@ -508,9 +544,7 @@ public class DocIdEncodingBenchmark {
Files.newInputStream(Path.of(inputFilePath), StandardOpenOption.READ));
} else {
DOC_ID_SEQUENCES =
docIdProvider.getDocIds(
DocIdEncodingBenchmark.class.getResourceAsStream(
"/org.apache.lucene.benchmark.jmh/docIds_bpv21.txt"));
docIdProvider.getDocIds(DocIdEncoder.Bit21With3StepsEncoder.class, 100, 100, 512);
}
} catch (IOException e) {
throw new RuntimeException(e);

View File

@ -1,18 +0,0 @@
# Any line which doesn't start with a pound sign is considered a sequence ( array of integers )
# Sequences should be contained in a line (\n) and should be separated by a comma (,)
# Blank lines are allowed.
# Taken from NYC Taxi BKD Tree Leaf blocks which can be represented in 21 bits without any data loss.
270868,1354402,1001357,1188141,614345,823249,955812,524727,33848,920354,912964,27329,659459,938249,1094207,1119475,335026,828262,1137164,1200383,535709,917083,272762,98216,865827,1320140,86065,285026,1300025,867222,115295,543105,729239,1074088,1190650,1206580,1241860,1343448,1007165,796400,166067,824724,1190755,40370,47587,69165,71539,75497,97056,98534,111989,125772,127017,130221,130867,146356,169507,202284,204382,210889,214257,222024,240243,245495,263500,298028,338265,341071,351839,377703,398449,401454,422750,437016,440081,449048,457054,480446,482000,506291,515137,525216,529295,532078,548882,554806,561107,575685,575940,583209,590657,595610,602444,613369,615987,618498,618549,625679,644023,648630,650515,660371,665393,674824,717089,718255,730123,753681,762335,767541,772169,830406,832355,838246,843573,844978,848910,850949,868434,889963,918089,971559,979233,1019604,1038100,1052977,1056285,1078119,1095552,1101935,1109608,1187018,1207479,1218674,1231614,1244877,1254300,1269298,1271640,1284238,1317059,1318537,1324592,1336627,1337717,1342370,1349469,53995,162496,278702,794069,1004390,1069339,26927,102928,141672,144991,203390,588398,892482,71823,1208477,1111385,1154044,1196631,581099,728969,984399,1183707,885502,410436,481976,523715,543117,743257,1087872,1243653,1268960,1061500,545236,548262,692764,1104894,1316940,424397,981354,996772,381666,548830,894825,397856,15073,49877,99132,237910,305680,394957,406129,409820,410402,554710,589680,619735,717215,835463,842990,852837,881664,932203,1097771,1099550,1108559,1108573,1238791,1241513,1254184,1305826,1320107,447526,1240738,218875,1302762,589024,66720,705418,30243,68439,257453,543023,545768,794973,943660,1093665,1137144,1137155,161039,375532,375614,631638,378676,968307,1279411,200732,1302423,78863,459829,1085773,172650,261116,18323,126884,249690,296774,495032,548631,672344,933950,1006265,1158863,121485,1037749,114168,505759,79827,656742,699990,804813,964578,991414,1005102,1058218,90676,141485,286093,413223,423879,426709,474171,532623,567289,606457,668266,703627,708341,716115,826851,992480,994509,1085724,1178728,1341924,1351371,53549,61888,92199,273868,375330,447062,459696,483358,564821,577424,638524,683678,703841,704870,841234,895065,909173,969243,997606,1228439,1236367,1249241,1287369,1300986,2731,56796,83624,195949,210371,221112,244612,398038,424234,444566,445443,510300,513326,522469,627609,700787,703297,706838,867636,874946,895111,935145,1005915,1031599,1035988,1092180,1129961,1138729,1163447,1313435,1348623,677297,3683,21930,31361,58012,80413,90236,93334,95938,108650,110480,153740,160754,161530,180089,201552,204127,218347,223282,233582,274509,305715,330779,345811,363922,380514,408389,413092,439515,464255,482446,508774,535377,538848,585885,589766,611894,623557,632046,664148,709237,726627,790630,826400,827832,873629,927290,977594,1024146,1028941,1110613,1113501,1116453,1117223,1129591,1139102,1151598,1179220,1225066,1239028,1241338,1258446,1308188,1338899,1347143,1062678,13682,20848,32490,42603,54220,54839,70582,79870,101916,107072,145421,160645,181788,205826,210489,223441,235372,244013,245507,259167,262314,264137,269681,302847,304093,305896,314909,317681,334100,334137,341225,344088,361014,373084,379755,381971,420012,447338,468889,470850,478342,482330,503664,540547,548290,551615,553397,581630,597393,597448,612979,618450,621708,680435,681975,699087,755501,770569,791096,794610,887149,891532,892642,896578,899463,905894,914556,939056,941892,1005237,1005508,1019257,1045047,1061345,1087990,1091402,1113898,1116195,1131149,1150913,1164752,1175740,1187408,1194255,1208301,1208961,1210179,1221615,1227887,1269492,1289182,1320129,1328172,1336702,1340338,1347051,1351492,10068,17246
29441,36352,49034,61163,67440,93332,97464,98185,100610,101385,108554,110008,123567,131513,147032,164734,167983,196548,196878,197235,205361,223342,237560,247316,278721,280741,280971,284301,286868,307118,312945,321331,321617,322009,326536,336799,343842,408267,409331,423433,430267,431298,432639,447736,474459,478478,484611,493193,506290,513810,532735,538276,541954,548194,549642,562671,567876,572952,576006,581886,583933,584579,585746,617845,630485,631998,647237,663458,666451,669289,674171,676658,685403,691337,693158,706155,715114,716147,730024,754250,760849,769629,772537,775818,793597,797357,805825,821766,823197,825456,831619,847502,871207,883153,893897,902653,906342,940941,943667,957849,970500,991567,1003024,1012891,1016239,1017324,1022438,1028281,1029701,1030067,1039853,1043228,1045517,1051469,1063095,1065932,1115823,1119333,1121198,1121699,1157776,1158587,1168729,1175452,1184216,1185338,1194155,1221155,1228444,1234886,1262591,1268042,1273859,1281831,1287372,1300468,1304844,1308139,1315722,1338976,1348738,1350164,1354333,24891,31207,36525,42605,44307,52384,57385,60340,68105,75615,80018,80795,84710,101361,128600,146175,146732,155847,164965,166945,166974,172740,202697,220116,221948,224332,224532,229615,247622,278292,286797,304146,307395,308236,325605,335369,339151,339159,353848,359726,372823,382529,415553,418459,418688,419732,432775,436655,437420,445696,458207,480217,486284,489870,493092,500539,507917,511652,532654,541948,556662,562491,563830,564180,574065,592650,597487,597551,603625,652943,678672,681682,702609,709672,715455,724332,729706,735079,743799,765512,767871,769752,770458,778994,793103,793932,794370,800831,816524,837131,855194,858427,864150,869107,883950,887148,888551,889227,892076,892483,899151,900921,906459,923952,927115,935520,943485,948236,948852,968975,972444,976682,981000,981165,1006709,1019449,1037496,1045870,1048884,1071470,1073301,1094953,1104223,1107436,1182814,1199566,1204959,1219092,1225352,1232339,1234799,1235725,1238957,1244225,1258028,1268270,1274521,1279167,1279439,1293065,1294199,1317426,1320453,1322553,1328874,1343271,1343464,1346645,1346761,2709,13663,21482,25304,33921,44693,47472,76033,79691,88548,91192,92592,110455,121207,123049,127902,150066,159238,160848,167669,170852,186372,188651,202083,236781,240919,245153,266498,281713,300270,301932,305120,305267,330670,332280,350160,363168,391458,402233,419759,423323,437226,438015,441175,443065,443861,444422,445881,450535,462483,470592,483151,485971,486165,490307,505952,514182,514981,546834,548271,550681,565913,578775,579149,579202,590415,619577,619704,633899,634872,639930,652867,653328,661343,666214,674342,683208,683919,690624,698815,701915,709131,713385,715868,721303,723337,723820,726342,755689,763837,765108,765729,769211,772536,780616,793038,799356,799723,806385,812216,822835,829224,833134,833844,847325,848891,854839,865061,865824,866411,879441,881408,906226,929950,935687,945619,966308,968176,968495,971682,992370,1001723,1026152,1028562,1040111,1055341,1061051,1067179,1067978,1075724,1077161,1096379,1107126,1128061,1143263,1155254,1157491,1158657,1167462,1182730,1196638,1203150,1210225,1214999,1219849,1225195,1227282,1236639,1239294,1241631,1241748,1249229,1256810,1261160,1274720,1292676,1295372,1299046,1317554,1320316,1322212,1328159,1331479,1342408,1342719,1351473,1353638,3406,4448,7331,9898,10791,11253,12913,15724,16520,27760,28885,29547,32952,36139,42447,56485,58992,59098,67598,68955,70572,71331,81224,89320,90180,90756,98556,101203,107077,112397,116534,120339,124946,127541,128758,135157,135894,139268,142928,149714,158802,161690,169194,169331,173044,174618,177200,183625,197241,205421,218782,223308,224206
224370,225310,233577,233730,234031,245573,256684,266275,274520,276793,276913,284753,289066,299051,308241,308666,311189,314120,322714,330382,331126,355667,358379,373383,382680,388307,390842,393059,399888,400959,412385,429529,429583,436090,438519,438603,441665,443889,444595,445976,446700,447522,448194,450286,482537,490228,499579,500094,500224,501874,508584,513137,513205,517699,521112,523094,527444,535070,537896,549300,549381,578751,579087,584370,584574,587166,615078,615678,615732,626115,626161,637419,638267,638375,641915,648570,654613,660859,664795,665222,669280,678832,693299,698040,702864,720128,730839,732699,735934,744774,749629,765980,767813,767945,770898,781999,788932,798349,800238,800630,805200,811691,812925,816038,825509,827631,828590,833407,834999,835864,839561,845509,848243,854609,860014,860739,864370,866419,868378,876031,889858,890177,894753,899735,900483,908441,909056,910052,911869,915583,923399,924710,925496,933422,935442,944324,950000,956218,956462,957112,957339,959478,960268,968429,977584,978494,979234,985321,985409,989419,993278,999948,1015640,1016357,1023818,1027290,1028736,1032714,1034756,1037709,1042551,1043791,1053915,1056453,1078772,1103120,1104211,1114860,1123040,1134949,1135672,1150453,1151875,1152009,1159899,1164548,1165325,1166766,1182182,1184164,1185829,1196632,1198424,1199223,1200098,1203267,1203945,1208888,1213174,1214801,1220135,1227391,1230829,1240044,1244473,1247042,1253076,1253506,1254088,1257745,1262216,1264931,1267093,1276154,1278005,1282237,1282334,1284191,1284590,1286038,1294298,1295217,1298848,1302279,1308238,1322864,1325577,1326558,1327107,1329399,1342483,1342902,1037,2067,3030,6297,7611,7882,10117,12015,16600,16738,18032,19900,20178,21481,22018,25722,25800,26699,27310,27747,28245,30624,32946,33786,33879,34545,36687,37390,37772,42944,45110,48094,50058,50480,50653,52107,52899,53596,53919,54332,54346,56914,58148,59175,60789,62044,65497,72261,72599,72688,75292,76285,77240,80689,81178,81826,82178,83501,83595,83645,84025,84211,94184,95588,96073,96524,97290,101501,102515,105191,105193,110318,110506,110572,111935,113531,113657,115795,116247,120184,122650,122981,126849,127822,133064,134261,134931,135453,138991,141475,142808,144634,145214,145478,145603,147938,148155,148649,149315,151178,153274,155558,158944,159020,159079,159652,161516,162245,163050,166885,170106,176949,177026,189522,190541,191364,194274,195255,198658,200055,200065,201852,208412,208497,210726,213428,216829,219148,220711,221530,223744,224461,224815,226049,227013,227677,228767,229670,233615,233655,236017,239511,243575,244726,244904,247140,249230,252454,253642,255554,257261,259134,259979,261220,263636,265834,266114,266138,268638,275741,276792,279891,286291,289795,291892,292831,294145,294440,294655,296437,296750,298124,300403,301960,302158,304829,305708,305729,307271,308833,308864,308897,311388,311960,312977,313160,314150,316887,320980,321912,323139,325147,328819,330656,332311,333880,340855,343690,345684,346069,346209,347852,348158,349240,350061,350971,352368,353500,353869,355625,356888,357099,359227,361023,366233,366284,367270,367948,370242,370450,372630,372843,375099,381534,383455,387573,390252,390780,391774,392187,393088,396464,396592,398732,401974,402013,402254,403556,404283,406677,408069,412487,414955,417172,421917,422053,423379,427590,430675,431869,436814,438872,443089,443300,445168,445374,445391,446980,448134,449000,449019,452183,453179,454733,457912,468825,469663,470465,471187,472115,475946,478660,479076,480423,482347,484796,485769,485898,486020,487659,488739,507116,512987,513385,514069,514517,519322,522309,522378,522551
524625,525193,530609,534873,535720,538763,539886,544623,547963,548217,555826,556153,561500,562897,570004,571605,573409,574404,574973,575943,575959,577924,583389,583725,584404,585886,588344,588357,591572,592078,592335,592748,593564,595497,597545,598168,598851,600067,601900,603042,607163,609898,610403,611503,615852,617105,618164,618522,618595,621340,622256,630706,631916,632111,633903,635945,637443,637682,640502,641786,642644,644351,644432,645627,651141,652478,653269,653599,654279,655169,656365,662556,662873,663700,663892,665407,665503,666106,666450,667158,667796,672179,672765,675786,678834,679977,680841,682242,684000,684536,691536,693278,693737,693942,694268,695039,695738,699064,701293,702607,703006,706458,706992,708749,709617,710117,710118,710142,712657,713944,714110,716398,718414,718719,719931,721841,727642,729245,730175,731788,741857,744510,745266,745700,745800,745835,745951,746929,749387,751492,752350,752802,757145,759462,766038,766218,770278,771611,771661,773907,775686,780668,782988,783165,783214,783407,789736,790868,792741,797963,800617,803186,807049,808566,810715,816558,823589,826846,827292,830991,831556,832721,836118,837332,839085,839279,839285,843771,845322,845686,847030,847939,854326,855449,860677,861028,861749,866234,868697,869755,869982,871046,872671,882570,884927,886217,891238,892069,892075,893684,896084,898175,901444,909255,916764,918419,920592,921529,921533,923276,924081,924091,924721,925092,925592,925676,926762,930358,933055,933687,939152,939848,940741,943079,944160,944206,947766,950120,952233,956584,959309,963930,967005,969305,971395,971512,974788,975899,975945,976728,980367,983083,983678,984063,985334,992456,993492,996129,998254,1000094,1004450,1004785,1005391,1005838,1009259,1010264,1010441,1011505,1015791,1017100,1019046,1019327,1019376,1021386,1021648,1023648,1026634,1027581,1030703,1031479,1031504,1037762,1038799,1040452,1041035,1041427,1041499,1044060,1046745,1050475,1051118,1052154,1054465,1056215,1059069,1059094,1059426,1061050,1061300,1064313,1070078,1072567,1074084,1074280,1074340,1078141,1079033,1079070,1081546,1085358,1085439,1087416,1089465,1089520,1090912,1095324,1096489,1098494,1100823,1101055,1101101,1103869,1104491,1104674,1104949,1105410,1106726,1108895,1109722,1110987,1111389,1116479,1116897,1126588,1131221,1132413,1132843,1137602,1138780,1138829,1139615,1139807,1143085,1146373,1146404,1151522,1151742,1151840,1152700,1154303,1157452,1160078,1165539,1168464,1171321,1171596,1176331,1177144,1182555,1182603,1182844,1186950,1188337,1190984,1194786,1196913,1199704,1203250,1213662,1213856,1216231,1217760,1218944,1220134,1221169,1223782,1233339,1233655,1233893,1235999,1236308,1236879,1238701,1241054,1242148,1242467,1242982,1244591,1247086,1247599,1249960,1251920,1252425,1253039,1253112,1253699,1254466,1254612,1254917,1255898,1257069,1258129,1259567,1260805,1261159,1261206,1261366,1262291,1263807,1263969,1266227,1269507,1274823,1277372,1277977,1279222,1280252,1281656,1282978,1283275,1284624,1285553,1287198,1287688,1287812,1288871,1293339,1294169,1294764,1295944,1296442,1297256,1299532,1299556,1299564,1299898,1300249,1300818,1301413,1304178,1310412,1311118,1312343,1312573,1313913,1314387,1315578,1316219,1317529,1317745,1318189,1318945,1319635,1322157,1324311,1325423,1326958,1329941,1333384,1334991,1337086,1340340,1342315,1343640,1345395,1346759,1347742,1350759,1352557,1353159,1354038,1354873,651143,897415,900150,1270218,826522,960254,418664,582066,484788,333441,1095776,270465,753227,984671,1209261,1299983,303,307,374,1407,3068,3657,5571,5862,8364,12777,12905,13747,13893,14421,15681,19515,19535,19602,20023,20031,22657,24400,26067,26145,26204,26230,26235,26427,27153,27624,27678,28205,28269,29278,29284,29335,30538,30793,30859,30905,32121,32128,32131,32151
32194,32195,32341,35589,35599,35620,35791,37127,37174,37230,37326,37850,38252,38939,38950,39407,40280,40639,41203,41207,41421,41525,41589,42161,42679,43446,43466,43834,43983,44054,44327,44615,44761,45417,45435,45682,45719,46232,46363,47684,47847,48958,48969,49261,50526,50546,51026,51182,51512,51654,53030,53255,53400,53824,55841,56407,56619,57257,57908,58315,58643,58713,59542,59691,60472,60915,60927,61454,61794,61836,62133,62589,62696,62700,63258,63609,63822,64332,65006,65104,65111,65266,65306,65333,65337,65362,65418,65570,65754,65762,65777,65779,66040,66143,66265,66571,67020,67170,67268,67567,67723,67966,67968,68343,68421,68426,68430,68515,68516,68523,68525,68536,68537,68558,68578,68594,68748,68862,68984,69015,69241,69439,69799,69815,69822,70058,70242,70251,70884,70892,70901,70955,70961,70967,70979,70981,71235,71319,71452,71602,71854,71954,72110,72169,72232,72487,72557,72749,72814,72910,73119,73262,73300,73564,73714,73757,73790,73813,74038,74161,74253,74532,74534,74985,75011,75030,75144,76023,76352,76353,76364,77013,77113,77454,77490,77637,77867,77872,78087,78265,78322,78412,78953,79527,79849,79856,80097,80501,80639,80823,81353,82542,82543,82608,83165,83292,83661,83770,83779,84471,84483,84491,84560,84562,85826,86189,86192,86211,86213,86960,87008,87110,87139,87755,87858,87968,88925,88926,88945,89215,89398,89829,90345,91050,91097,91651,91883,91957,93652,94007,94448,95973,96182,96499,97198,97292,98451,98611,99274,99644,99767,100048,100145,100554,100645,103194,104005,104022,104260,105543,105548,105601,105715,106851,107436,107775,107903,108043,108268,109566,109585,109867,110995,111120,111437,111439,111466,111520,112508,113501,113543,113644,113646,113683,114038,114125,114609,115380,115412,117204,117463,117538,118221,118231,118474,118513,118536,118718,118901,119146,119148,119405,119827,119831,120066,120103,120811,121214,121520,121932,123106,123221,123605,123722,124793,125379,126327,126716,126811,126826,127056,127336,127423,127525,127674,127765,127790,128403,128646,128939,129188,129298,129393,129520,129613,129615,131093,131124,131338,131579,131756,132470,132471,132743,133020,133034,133958,134099,134959,136360,136477,136493,136806,137661,138087,138254,138774,138794,139469,140398,141682,141890,142092,142266,142977,142978,144706,145115,145139,145170,145367,145533,145548,145549,145900,146153,146879,146948,146994,147090,147513,147567,147643,147726,147912,147927,148609,149792,149941,150187,151916,152748,154409,154414,154761,155128,155129,155204,156637,156749,156754,156761,156917,158050,158181,158253,158361,158372,158449,160321,161770,162700,162914,163723,163799,163976,164539,164612,164773,165154,166268,166364,166468,166526,167431,167742,168045,168452,168458,168479,168885,168922,168932,168982,169571,169899,170063,170077,170939,171067,171075,171082,171083,172001,172059,172126,172141,172155,172247,172259,172390,173235,174304,174387,174596,174861,175439,175802,176403,176482,176831,176992,177206,177221,177223,178349,178409,179076,179838,179894,179907,179912,179996,180004,180744,180849,180924,180999,181908,182758,183124,184378,184499,184657,185076,185094,185150,185151,185260,185877,185886,185912,185924,186729,186824,186926,186937,187795,187915,188606,188619,189420,189573,189595,189746,189751,191742,192008,192891,193025,193185,193268,193283,194027,194123,194454,194536,194601,195520,195560,195678,196010
196416,196630,197356,197857,198342,199249,199548,200302,200622,200934,201065,202218,202238,202257,202855,203147,203164,203174,203198,203465,203480,203592,203610,204032,204085,204204,204445,204991,205018,205056,205068,205709,206117,206147,206155,206276,206364,206425,206471,206474,206632,207392,207494,207663,207672,207675,207857,208106,208123,208205,208219,208310,208349,208388,208639,208646,209089,209291,209362,209945,209993,210003,210132,210134,210250,210258,210649,211183,211237,211243,211290,211360,211581,211799,211893,212063,212172,212248,212343,212391,212414,212659,212796,212836,212888,212923,212931,212973,213013,213300,213406,213479,213594,213608,213631,213760,213817,213912,213950,214274,214288,214416,214427,214577,214917,215511,215614,215966,216021,216035,216041,216431,216607,216680,216687,217210,218019,218098,218381,218414,218564,219376,219787,219924,219937,220286,221051,221088,221222,221772,222970,223054,224657,225325,225421,225504,225560,225602,225618,225660,225797,225805,225840,225847,226516,226796,226970,228292,228475,229428,229582,229666,229696,231746,231870,232143,232518,232523,232689,234384,234586,237085,237322,237381,237460,237587,237634,238283,239523,239542,239675,239683,241350,241762,241840,242204,242460,242625,243322,243324,243442,244275,244306,244483,244765,245264,245395,245429,245444,245767,245778,246087,246364,246394,246599,246711,247266,247295,247405,247438,247509,248232,248345,248350,248727,248822,248987,249052,249170,249425,249762,250150,250233,250273,250430,250433,250440,250451,250790,250811,250956,250999,251070,251100,251128,251217,251352,251398,251628,252658,252832,253069,253172,253250,253254,253284,253333,253448,253537,253564,253586,253608,253770,253839,254044,254928,255027,255109,255278,255400,255420,255422,256274,256277,256637,256639,256644,256767,256880,256960,256969,256985,257087,257159,257276,257308,257479,257492,257660,257703,257818,257989,258054,258445,258519,258550,258557,258600,258612,258647,258649,258734,258791,258933,258942,258945,258971,259872,260148,260179,260183,260209,260259,260273,260407,260443,260451,260459,260481,261017,261747,261875,262152,262403,263670,264044,264236,264538,264559,264577,265603,265641,265675,265756,265774,265797,266105,266879,266978,267001,267069,267174,268160,268277,269397,272072,272538,273740,273886,275133,275321,275414,275580,277883,278043,279143,280279,280310,280542,281250,281559,281564,282165,282297,283195,283971,284105,285231,285636,285873,286015,286023,286399,286721,286829,286929,287209,288143,288511,288558,289468,289516,289638,289642,289947,290191,290274,290298,291039,291138,291240,291267,291625,291689,291706,291950,291953,291954,292175,292841,293520,293580,293641,293813,293930,293958,294039,294545,295148,295210,295253,295294,295360,295424,295536,295603,295616,295624,295688,295739,295876,296042,296180,296300,296325,296592,297184,297216,297220,297234,297262,297269,297398,297400,297413,297427,297574,297646,297744,299015,299043,299078,299265,299442,299903,299916,300976,300980,301127,301156,301174,301258,301277,301352,301363,301461,301760,301977,302519,302520,302521,302681,302686,302844,303197,303213,303479,303506,303588,303891,304698,304709,304798,304948,304981,305202,305382,305437,305805,305980,306424,306543,306668,306684,306896,306905,308003,308048,308420,308467,308483,309226,309308,309405,310512,310521,312239,312326,312376,313302,313488,313920,314075,314490,316193,316272,316454,316495,316540,317693,317703,319826,319957,320024,320130,320243,320539,320688,321540,323406,323407,323540,323670,323814,323819,323905,324474,324630,324765,324907,326486,326493
326768,326897,326901,326946,327796,327931,327935,329297,329306,329664,329666,331508,331575,331664,331668,331794,331807,333296,333337,333347,333349,333401,334027,334144,334202,334229,334251,334271,334597,334622,334699,334868,334869,335398,335489,335795,335853,335859,335865,335867,336060,336068,336183,336557,336700,336884,337336,337911,338076,338139,338146,338157,338188,338190,338230,338337,339610,339809,339818,339824,339828,340353,340464,340547,340610,340648,340906,340971,341135,342104,342191,342324,342474,342915,343071,343250,343270,343385,343521,343619,343940,343988,344822,344826,344980,345139,345176,345231,345357,345473,345494,345500,345587,346474,347114,347154,347416,347419,347467,347523,347529,347571,347608,347698,347709,348410,349031,349068,349136,349139,349147,349172,349177,349179,349182,349323,349337,349347,349479,349490,349613,349701,349770,350194,350195,350197,350306,350319,350336,350366,350584,350619,350661,350667,350708,350909,350923,350994,351006,351684,351699,353104,353335,353577,353686,353798,353804,353931,354118,354370,354938,355220,355713,356016,356248,356253,356514,356744,357446,357546,359545,359680,360424,361079,361686,362170,362183,362295,362861,363196,364624,365053,365440,365492,365632,365763,366042,366425,367689,368051,368071,369229,369243,369390,369520,369642,369899,371106,371295,371316,371417,372331,374301,374452,374607,374739,375838,376041,376185,377181,377259,377339,378953,379073,379101,379132,379297,379310,379428,379548,380619,380863,380868,380905,380978,381039,381133,381149,381236,382181,382397,382411,382942,382974,382978,383022,383023,383731,383734,383927,384107,384138,384147,384180,384195,384200,384202,384463,384560,384588,384620,384623,384635,384711,384840,384852,384855,385222,385241,385253,385305,385358,385366,385396,385413,385848,386285,386293,386574,388128,388184,388229,388367,388539,388730,390081,390204,390266,390296,390416,390450,390535,390542,390592,390636,390691,390724,390751,390892,392061,392220,392251,392299,392376,392537,392659,392683,392687,393191,393379,393555,393620,393705,393829,393957,394479,395520,395830,395975,396198,396201,397333,397471,397474,397492,397688,397713,397714,398929,399054,399055,399345,399475,399613,399709,399843,399902,399903,400766,400920,401060,401197,401809,401956,402410,402733,403116,403673,403701,404095,404105,404119,404518,404526,404617,404637,405992,406199,406827,407002,407225,408656,408811,408893,409804,409900,410071,410091,410199,411551,411552,411553,412057,412142,412344,413901,413957,414495,414590,415337,417553,417857,420699,420897,421220,421235,421347,424645,424989,425036,425059,425255,426071,429128,429132,429203,429621,432657,432809,433036,435169,435757,437934,439883,440316,440817,440994,442643,442672,442678,442850,442874,442877,444677,444842,445654,445791,445956,446271,446437,446488,446512,446813,447292,447323,447373,447383,447400,447444,447481,447566,447570,447980,447991,448061,448313,448667,448676,448721,448724,448921,448924,448928,448939,448943,449539,449585,449599,449602,449617,449681,449693,449718,449816,449860,451044,451179,451328,451330,451413,451417,451721,451738,451756,452128,452263,452694,453847,453972,454036,454042,454053,454896,454972,454978,455007,455482,455502,455892,455909,456524,456950,456985,457506,458478,458541,459663,459727,459805,461473,461914,462070,462181,462249,462255,462333,463348,463904,463934,464141,464706,464917,464927,464991,465169,465206,466540,466570,466571,467138,467917,467993,468176,468179,468245,468298,468334,468397,468427,468461,468957,470109,470148,470155,471108,471263,471582,471807,471890,471993,472571,472588
472847,473614,473735,473758,474234,475517,475523,475578,475645,475722,475750,475811,475826,476524,476801,476950,476962,477542,477632,477792,478259,478935,479784,479917,480068,481124,482327,483542,483558,483904,484001,484267,484270,484465,484714,484963,484964,484977,485134,485556,485578,486446,487880,488008,488249,488379,489089,489453,489581,489586,489735,489799,490488,490543,492109,492433,492562,492778,492922,493159,493613,496661,496755,497479,497517,497527,497539,497566,498494,499179,501539,501614,501649,502641,503064,505081,505109,505199,505503,505696,505750,506214,507547,507595,507678,508237,509644,509723,509840,509847,510017,510235,511212,512041,512485,513246,513664,513987,514000,515217,515631,515791,516028,516217,516251,516818,516908,517255,517498,517589,517960,518480,518554,518645,518656,518657,518658,519229,519566,519887,520594,520638,521882,522299,524087,524234,524332,524484,524497,526205,526368,526641,526680,526976,528146,528152,528496,528686,528831,528839,530798,530800,531444,531589,533419,534037,534048,536184,536324,536330,536481,536880,538882,538897,539217,539328,539410,539462,539509,539684,539723,541825,542013,542294,542605,544219,544325,545036,545854,546343,547120,547694,548852,548928,549063,549164,549207,549697,550418,550487,550777,551081,551150,551268,551461,551676,551719,551780,552202,552301,552310,552321,552515,552536,552568,553013,553609,553613,553791,553865,553938,553977,553981,553983,553990,554129,554177,554297,554308,555100,555392,555399,556112,556143,556527,556581,556623,557205,557218,557222,557512,557739,557761,558400,558474,558515,558535,558570,559176,559228,560230,560397,560681,560756,561129,561283,561562,561710,561749,562270,562554,562734,562924,562939,563270,563295,563345,564530,564531,564565,564769,564787,564862,565714,565958,566075,566076,566120,566210,566441,566483,566490,566502,566534,566668,566677,566891,567189,567512,567949,568036,568037,568412,568430,568549,568558,568887,568907,569023,569028,569043,569794,569795,570029,570237,570702,571000,571324,571626,571988,572006,572790,573002,573240,573303,573311,574462,574482,574483,575461,575732,575774,576439,576585,576845,577756,577889,578017,578044,578160,578694,581539,582008,582030,582964,583411,583741,583778,583841,584125,584178,584197,584302,585363,585513,587022,587952,588534,588708,588725,588744,588785,589861,589887,590842,590909,592141,592177,592270,592601,592615,593023,593096,593103,593117,593133,593156,593215,593445,593457,594195,594440,594561,594624,594679,594692,594754,594784,594790,596279,596411,596420,596430,596904,596930,597037,597129,597190,597221,597255,597335,598804,598923,599211,599266,599357,599458,599652,600720,600974,601102,601147,601240,601281,601395,601527,601537,601541,601544,601657,601674,602142,602246,602349,602806,602807,602870,603006,603067,603210,603324,603333,604028,604171,604306,604649,604651,604694,604698,604760,604871,604873,604880,604902,604942,604953,605415,605429,605483,605498,605509,606404,606682,606835,607450,608490,608526,608555,608754,608757,608759,608777,608784,608831,608873,608920,608926,608931,609114,609136,609882,609883,610422,610811,610998,611034,611166,611174,611314,611446,611468,612231,612479,612965,612992,613210,613211,613252,613447,613469,613483,613618,613633,613886,614320,615017,615030,615697,615698,616101,616305,616352,616428,616613,617061,618217,619252,619379,619499,619527,619618,619656,619758,619932,620658,620860,621741,621778,622201,622559,622705,622792,622842,623127,623150,623852,624609,625494,625784,625859,626271,627650,628318,628501,629064,629550,629693,631408,631410,631833,633454,635120
635131,636197,636256,636295,636890,637289,637651,637917,638256,638642,638875,639042,639635,639673,639689,639804,639904,640037,640049,640057,640139,640207,640299,641121,641155,641313,642264,642275,642410,642661,642679,642684,642767,642916,643324,643501,643586,643736,643890,644033,644081,644292,645049,645086,645128,645191,645759,646002,646006,646055,646193,646443,646771,646952,646963,646970,647015,647105,647125,647205,647246,647597,647661,647671,647747,647793,647994,649106,649285,649934,650074,650231,650748,650769,650919,650987,651086,651688,651705,652059,652626,652655,652667,652834,652858,653781,653787,654992,655018,655043,655048,655689,655711,655776,655835,655859,655942,656197,656217,656255,656431,656552,658256,658347,658386,658614,658847,658979,659710,659939,660069,660172,660389,660547,661614,661908,662376,662414,662586,662657,662856,662953,664600,665423,665535,665593,667354,667360,667617,667624,667926,668142,668591,668672,668981,669001,672430,672561,673353,673880,675208,675358,675842,675880,677835,677841,677849,678022,678073,679681,679694,679707,679759,679897,679912,680034,680774,681585,682188,682551,682557,682578,682580,682596,682833,682866,682881,683511,683512,683553,683563,683564,684044,684808,684868,684920,684942,684943,684991,685088,685117,685118,685136,685177,685315,687227,687452,687477,687551,687606,687628,687644,687648,687654,687688,687738,687825,687833,688419,688702,688722,689125,689251,689492,689518,689608,689641,689671,689714,689849,689858,689910,689922,690088,690323,690588,690795,690956,692068,692393,692452,692501,692570,692590,692680,692967,693116,693443,693599,693677,693693,693873,693903,693945,694099,694222,694223,694249,694260,694264,694713,695010,695172,695178,695184,695187,695602,695734,695825,695923,696067,696119,696129,696907,696908,697077,697086,697347,697457,697706,697713,697907,697919,698005,698513,699383,699700,699794,699815,699816,699857,700049,700230,700234,700240,700561,702101,702281,702681,703428,703582,704080,704679,705101,705904,706007,706247,706316,706373,706512,708409,708435,708489,708723,708813,709043,709275,710217,710423,710517,710615,710719,711525,711680,711726,711881,714372,714389,717231,717500,717646,718108,718113,719476,720089,720313,720602,720687,720781,722148,723704,725195,725251,725777,725937,726015,726146,726827,727225,727500,727639,727724,727769,730553,730643,730651,731080,731136,731228,731776,732014,732070,732663,732760,732767,732778,732857,733206,733214,733218,733250,733273,733278,733281,733287,733288,733314,733325,733851,733966,734015,734028,735015,735026,735032,735275,735298,735399,735407,735444,735515,735530,735554,735555,735560,735561,735570,735581,735638,736639,736786,736789,737761,737785,737914,738016,738019,738032,738037,738064,738186,738310,738667,738832,738845,739018,739266,740209,740293,740295,740353,740379,740409,740435,740557,740590,740666,740670,740716,740730,741302,741596,741612,741629,741739,742339,742364,742435,742491,742499,742572,742579,742590,742603,742707,742715,742792,743493,743633,743658,743814,744275,744314,744333,744426,744482,744715,745446,745454,745567,745666,745667,746051,746090,746116,746243,746245,746247,746296,746320,746442,746857,747231,747517,747752,748001,748099,748189,748579,749155,749524,749525,749973,750105,750247,750273,750385,750441,750532,750553,751762,752429,752584,752608,752633,752672,753251,753362,753382,753474,753578,753662,753666,754134,754144,755686,755723,755953,756095,757224,757359,757661,758411,758860,758913,759114,759459,759570,759579,759668,760483,760949,761103,761592,763579,763587,763934,763948,764994,765330,768066,768087
768092,768238,768308,768477,768767,768802,768912,770655,772521,772577,772665,772935,773010,773082,773183,774522,774548,774551,774583,774693,774730,774772,774817,774838,775198,777436,777556,777559,777715,779018,781237,781270,781294,781397,781578,781821,781915,783365,785306,785414,785762,785836,785897,786052,786066,786105,789933,790101,791227,791701,791864,793142,793255,793292,793656,795390,795663,795691,795999,798547,798603,798754,798793,798918,799899,800397,800425,800524,800719,801396,801975,802183,802270,802275,802315,802340,802577,802596,803558,803644,803648,803792,803804,803809,803879,804774,805116,805120,805240,805928,805940,806099,806815,806986,806992,807188,807225,807879,808251,808258,808364,808550,808673,808802,810047,810428,810433,810494,810507,810511,810520,811888,811992,812017,812139,812190,813051,813205,813336,813341,813879,813904,814096,814228,815139,815334,815584,815751,815893,816010,817153,817224,817253,817303,817370,818559,819211,819425,819460,819632,820864,821155,822331,822511,822720,822778,822791,823804,824245,824385,825817,825931,825969,826050,826101,827060,829264,829496,829638,829827,829832,829843,829911,829926,829928,830676,831362,831374,831526,834681,834691,836148,836509,836512,837255,837398,837501,838433,838516,838546,838580,838594,838878,838957,840220,841068,841665,841686,841688,841908,842128,842542,842635,842767,843496,844593,845825,845885,845954,846034,846051,846170,846369,846370,846421,846474,847412,847436,847570,848201,850207,850295,851712,851797,851798,852109,852686,854851,855269,855375,855853,856158,857238,858135,859008,859873,859929,860937,862156,862159,862271,863197,864426,864458,864535,864588,864658,864667,864675,864973,866267,866703,866705,866752,866891,867857,867934,867935,868164,868275,868457,868531,868623,868658,869160,869188,869197,869225,869399,870242,870601,870729,871399,871413,871425,871437,871659,872484,872679,872802,873187,873264,873367,873500,874419,874621,874722,875153,875254,875577,877394,877563,877566,877733,877789,877804,877810,878023,878789,879885,880196,880356,880386,880512,880588,880695,880926,881628,882091,882159,882579,883334,883368,883384,883394,883819,884620,884949,885022,885789,885985,886102,886108,886139,886183,886298,887538,887827,887828,887843,887848,888131,888632,888685,888958,888964,888983,889089,889340,889826,890403,890714,891218,891654,891828,892473,893578,893734,894103,894227,894477,894502,894507,894610,894631,896445,896605,896733,896793,896795,896999,897389,899089,899445,899845,900251,900252,900365,900455,900694,900903,901370,902020,902083,902091,902258,902370,903759,903760,903776,903828,903974,904433,904989,905493,905565,905575,905587,905638,905676,905738,905751,905871,907246,907308,907331,907435,907451,907486,907650,907719,907833,908138,908567,908822,909465,909467,909680,909731,909834,909835,909896,909984,910441,910555,910557,910705,910928,911314,911767,912080,912133,912169,912180,912255,912265,912938,913799,913806,913908,913979,914243,914452,914766,915150,915224,915545,916142,916351,916422,916474,916554,916585,916676,916680,917660,917678,917695,917727,917891,917981,917992,918046,918065,918267,919214,919289,919393,919394,919494,919801,920287,920396,920822,920838,921102,921339,921558,921750,922270,922419,922549,922609,922684,922736,922825,922937,922953,923283,923306,923356,923359,923378,924010,924270,924427,924492,925118,925141,925161,925221,925228,925232,925412,925467,926569,926669,926821,927032,927159,927256,927314,927318,927391,927673,929001,929004,929032,929391,929521,929682,929927,930922,931093,931228,931756,931795,931921,932093,932218,932308,932309
930197,934668,945234,965589,989777,1005121,1040960,1050408,1090742,1095489,1225903,1249549,1259623,1262582,1278210,1298470,1301368,1302426,1313230,1349447,1354105,1013149,24197,27190,27638,28791,28894,65332,68957,71682,74993,77447,78071,82156,84495,88112,92163,97133,115453,116456,118111,131342,167692,169793,172146,179227,184988,189314,191872,198434,201669,212692,217137,218132,225406,237641,239268,244172,245199,245903,246825,247145,256993,260549,273197,284620,286783,287090,289463,291215,334173,336332,336451,340341,348574,349531,366536,381766,386402,397416,397609,411936,416309,421668,424458,428251,447227,448020,449889,451353,456182,461739,462336,474702,477474,487198,488291,493142,508060,512106,514979,516616,521268,532687,545808,548784,552011,563427,578274,588845,591361,603306,607166,613039,620234,622055,624715,637835,638756,651631,654342,666364,668513,671386,672644,682818,685579,700510,703270,707473,712811,720381,723186,735374,743929,751408,763692,768025,770269,7
1160378,1162848,1176905,1180271,1182172,1185858,1198484,1200187,1213514,1236266,1247107,1256945,1257065,1260624,1272984,1277508,1278433,1292379,1310537,1314377,1327385,1341893,1343843,1347808,1352467,582256,490224,70503,92374,114623,128973,254734,260440,292791,328918,361116,371713,412908,431512,465564,473091,565949,697743,787104,818250,821661,870513,886781,931221,1273735,1321255,1339387,9979,42716,75280,90243,118503,169914,222331,278425,318149,322634,322661,423945,426075,433962,493006,556546,567131,649725,667468,684173,732561,759359,810748,818916,890813,1050870,1142906,1178174,1249786,1270110,1344433,1351376,1352850,296,38751,141784,163337,180214,189988,213291,235167,269836,286908,315662,354130,354901,370533,371340,382804,418104,425899,431537,464624,498547,503697,503701,634716,661019,683732,752402,806126,807462,808704,812015,966654,972928,1058811,1160090,1186570,1222170,1339460,1343938,4063,11328,15168,26642,28546,39627,96271,117547,128980,199170,209503,210318,220876,235721,263177,283102,285093,310772,355105,367434,372809,375635,437543,441215,552631,552862,603593,616209,633643,636226,638508,644082,649971,652529,679611,732918,734268,736640,887555,957868,1000639,1020991,1094675,1101265,1134568,1137783,1146337,1297135,1307337,1345558,59944,114967,123001,140425,313919,404692,481820,491697,599461,603536,652138,684740,708525,739649,786735,809055,861501,868696,878631,890077,896096,911444,920376,922608,950192,1000129,1001126,1012354,1027316,1040429,1049812,1088481,1142749,1194363,1347237,83710,112967,121178,225437,270718,306024,350139,363355,725501,742173,743993,854035,901168,1014706,1115014,1135633,1164254,1195178,1216953,1303992,1346575,1347717,117065,169529,317585,382741,424268,442101,698365,744538,753281,788200,843060,844374,864

View File

@ -1,13 +1,27 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.benchmark.jmh;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.store.IOContext;
@ -17,44 +31,11 @@ import org.apache.lucene.tests.util.LuceneTestCase;
public class TestDocIdEncoding extends LuceneTestCase {
private static final Map<Class<? extends DocIdEncodingBenchmark.DocIdEncoder>, Integer>
ENCODER_TO_BPV_MAPPING =
Map.of(
DocIdEncodingBenchmark.DocIdEncoder.Bit21With2StepsEncoder.class, 21,
DocIdEncodingBenchmark.DocIdEncoder.Bit21With3StepsEncoder.class, 21,
DocIdEncodingBenchmark.DocIdEncoder.Bit21HybridEncoder.class, 21,
DocIdEncodingBenchmark.DocIdEncoder.Bit24Encoder.class, 24,
DocIdEncodingBenchmark.DocIdEncoder.Bit32Encoder.class, 32);
@Override
public void setUp() throws Exception {
super.setUp();
}
static class FixedBPVRandomDocIdProvider implements DocIdEncodingBenchmark.DocIdProvider {
@Override
public List<int[]> getDocIds(Object... args) {
DocIdEncodingBenchmark.DocIdEncoder encoder = (DocIdEncodingBenchmark.DocIdEncoder) args[0];
int capacity = (int) args[1];
int low = (int) args[2];
int high = (int) args[3];
List<int[]> docIdSequences = new ArrayList<>(capacity);
for (int i = 1; i <= capacity; i++) {
docIdSequences.add(
random()
.ints(0, (int) Math.pow(2, ENCODER_TO_BPV_MAPPING.get(encoder.getClass())) - 1)
.distinct()
.limit(random().nextInt(low, high))
.toArray());
}
return docIdSequences;
}
}
public void testBPV21AndAbove() {
List<DocIdEncodingBenchmark.DocIdEncoder> encoders =
@ -62,7 +43,8 @@ public class TestDocIdEncoding extends LuceneTestCase {
final int[] scratch = new int[512];
DocIdEncodingBenchmark.DocIdProvider docIdProvider = new FixedBPVRandomDocIdProvider();
DocIdEncodingBenchmark.DocIdProvider docIdProvider =
new DocIdEncodingBenchmark.FixedBPVRandomDocIdProvider();
try {
@ -70,7 +52,7 @@ public class TestDocIdEncoding extends LuceneTestCase {
for (DocIdEncodingBenchmark.DocIdEncoder encoder : encoders) {
List<int[]> docIdSequences = docIdProvider.getDocIds(encoder, 100, 100, 512);
List<int[]> docIdSequences = docIdProvider.getDocIds(encoder.getClass(), 100, 100, 512);
String encoderFileName = "Encoder_" + encoder.getClass().getSimpleName();