Mercurial > hg > Members > shoshi > jungle > jungle-core
changeset 219:c86d39eb19d1
add TreeMapBenchMark
author | tatsuki |
---|---|
date | Tue, 01 Sep 2015 16:27:25 +0900 |
parents | 0b9807c1c6b4 |
children | 9404bf19da41 |
files | src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/benchMark/Data/TreeMapBenchMark.java |
diffstat | 1 files changed, 29 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/jungle/benchMark/Data/TreeMapBenchMark.java Tue Sep 01 16:27:25 2015 +0900 @@ -0,0 +1,29 @@ +package jp.ac.u_ryukyu.ie.cr.jungle.benchMark.Data; + + +import jp.ac.u_ryukyu.ie.cr.jungle.data.treemap.TreeMap; + +import java.util.ArrayList; +import java.util.Collections; + +public class TreeMapBenchMark { + public static void main(String[] args) { + for (int i = 1; i <= 10; i++) { + TreeMap<Integer, Integer> map = new TreeMap<>(); + ArrayList<Integer> list = new ArrayList<>(); + + for (int count = 1; count < 100000 * i; count++) { + map = map.put(count, count); + list.add(count); + } + + Collections.shuffle(list); + long t1 = System.currentTimeMillis(); + for (Integer num : list) { + map = map.delete(num); + } + long t2 = System.currentTimeMillis(); + System.out.println((i * 100000) + " time = " + (t2 - t1)); + } + } +}