Mercurial > hg > Members > shoshi > jungle > jungle-core
changeset 185:6d125ba315d8
benchmark new treeMap
author | tatsuki |
---|---|
date | Mon, 30 Mar 2015 00:49:19 +0900 |
parents | d2b710337eaa |
children | 209df7faa37c |
files | src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/test/FJTreeMapGetIteratorThread.java src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/test/TreeMapBenchMark.java |
diffstat | 2 files changed, 16 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/test/FJTreeMapGetIteratorThread.java Sun Mar 29 23:29:27 2015 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/test/FJTreeMapGetIteratorThread.java Mon Mar 30 00:49:19 2015 +0900 @@ -1,11 +1,9 @@ package jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.test; - -import fj.P2; -import fj.data.Option; -import fj.data.TreeMap; +import jp.ac.u_ryukyu.ie.cr.tatsuki.TreeMap.TreeMap; import java.util.Iterator; +import java.util.Optional; /** @@ -34,11 +32,9 @@ @Override public void run() { while (loop) { - Iterator<P2<String, String>> it = map.iterator(); - for (; it.hasNext(); ) { - if (it.next()._2().equals("50")) + Optional<String> value = map.getLoop("50"); + if (value.isPresent()) findCount++; - } } } }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/test/TreeMapBenchMark.java Sun Mar 29 23:29:27 2015 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/jungle/test/TreeMapBenchMark.java Mon Mar 30 00:49:19 2015 +0900 @@ -30,25 +30,31 @@ AbstractTreeMapThread readThread[] = null; - TreeMap<String, String> map = TreeMap.empty(Ord.stringOrd); List<String> list = List.nil(); if (args[0].equals("list")) { for (int count = 0 ;count < 100 ; count++) { list = list.cons(String.valueOf(count)); } } - for (int count = 0 ;count < 1000 ; count++) { - map = map.set(String.valueOf(count), String.valueOf(count)); - } + for (int THREAD_COUNT = 1; THREAD_COUNT <= cpuNum; THREAD_COUNT++) { readThread = new AbstractTreeMapThread[THREAD_COUNT]; - if (args[0].equals("getLoop")) { + if (args[0].equals("fj")) { + TreeMap<String, String> map = TreeMap.empty(Ord.stringOrd); + for (int count = 0 ;count < 1000 ; count++) { + map = map.set(String.valueOf(count), String.valueOf(count)); + } for (int count = 0; THREAD_COUNT > count; count++) { readThread[count] = new FJTreeMapGetLoopThread(map); } - } else if (args[0].equals("get")) { + } else if (args[0].equals("tatsuki")) { + jp.ac.u_ryukyu.ie.cr.tatsuki.TreeMap.TreeMap map = new jp.ac.u_ryukyu.ie.cr.tatsuki.TreeMap.TreeMap(); + for (int count = 0 ;count < 1000 ; count++) { + map = map.put(String.valueOf(count), String.valueOf(count)); + } + for (int count = 0; THREAD_COUNT > count; count++) { readThread[count] = new FJTreeMapGetIteratorThread(map); }