Profile java parallel/sequential sorting -
does know way profile sorting algorithm in java(sequential , fork join) ? because running time short (sorting list size 5000..), system.nanotime() seems not work properly.
i plan run same test case many times (1000) , rid of first 100 results (avoid hotspot compiler problem) , average of running time using system.nanotime(). suggestion on ?
thanks lot!
can way ?
double count = 0; double start, end; for(int r = 0; r < warmup; r++) { // test } for(int t = 0; t < runs; t++){ start = system.nanotime(); // test end = system.nanotime(); count += start - end; } double avg = count/avg
i can assure nanotime() work , if want avoid hotspot warmup need run 10k times. should find sort of 5k element quick , 1k test not much. need write test produces reproduce-able results. if haven't, down fix test because not good.
i suggest try , see results get.
on old computer, sort of 5k random int values takes 500 us. note: sorting sorted array not give same result. (so cannot sort same array each time)
a simple way run test number of times ignoring first n runs do.
long start = 0; for(int r = -warmup; r < runs; r++) { if (r == 0) start = system.nanotime(); // test } long avg = (system.nanotime() - start)/runs;
Comments
Post a Comment