Mercurial > hg > Members > tatsuki > JungleXMLReader
changeset 40:59a7d2cffc86
add timeMeasurementJuGrix
author | one |
---|---|
date | Thu, 13 Nov 2014 23:34:41 +0900 |
parents | 22edfb7f47ad |
children | 037731e99d6e c036d36c33af |
files | src/main/java/ac/jp/u_ryukyu/cr/ie/tatsuki/time/TimeMeasurementJuGrix.java src/main/java/ac/jp/u_ryukyu/cr/ie/tatsuki/xmlReader/ReadXmlPutAttributeCreateIndex.java |
diffstat | 2 files changed, 86 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/ac/jp/u_ryukyu/cr/ie/tatsuki/time/TimeMeasurementJuGrix.java Thu Nov 13 23:34:41 2014 +0900 @@ -0,0 +1,75 @@ +package ac.jp.u_ryukyu.cr.ie.tatsuki.time; + +import java.util.LinkedList; +import java.util.Random; + +import jp.ac.u_ryukyu.cr.ie.tatsuki.bbs.JuGrix; + +public class TimeMeasurementJuGrix { + + static int roopCount = 1000; + + public static void main(String args[]) { + + JuGrix jugrix = new JuGrix(false); + System.out.println("start : no index"); + + String orgId = "o:2"; + String personId = "p:1"; + LinkedList<String> filterIds = new LinkedList<String>(); + filterIds.add("r:5"); + functions(jugrix, orgId, personId, filterIds); + + long sumTime = 0; + for (int count = 0; count < roopCount; count++) { + Random random = new Random(); + int ran = random.nextInt(30); + orgId = "o:" + String.valueOf(ran); + personId = "p:" + String.valueOf(ran); + long t1 = System.currentTimeMillis(); + functions(jugrix, orgId, personId, filterIds); + long t2 = System.currentTimeMillis(); + // System.out.println(count + "回目=" + (t2 - t1) + "s"); + sumTime = sumTime + t2 - t1; + } + System.out.println("合計 = " + sumTime + "s"); + System.out.println("end"); + + jugrix = new JuGrix(true); + functions(jugrix, orgId, personId, filterIds); + System.out.println("start : use index"); + sumTime = 0; + + for (int count = 0; count < roopCount; count++) { + Random random = new Random(); + int ran = random.nextInt(30); + orgId = "o:" + String.valueOf(ran); + personId = "p:" + String.valueOf(ran); + long t1 = System.currentTimeMillis(); + functions(jugrix, orgId, personId, filterIds); + long t2 = System.currentTimeMillis(); + //System.out.println(count + "回目=" + (t2 - t1) + "s"); + sumTime = sumTime + t2 - t1; + } + System.out.println("合計 = " + sumTime + "s"); + System.out.println("end"); + } + + private static void functions(JuGrix jugrix, String orgId, String personId, LinkedList<String> filterIds) { + jugrix.childOrganizationIds(orgId, filterIds); + jugrix.competentRoleId(personId); + jugrix.concurrentRoleIds(personId); + jugrix.deepChildOrganizationIds(orgId, filterIds); + jugrix.deepChildOrganizationIdsPlus(orgId, filterIds); + jugrix.deepParentOrganizationIds(orgId, filterIds); + jugrix.deepParentOrganizationIdsPlus(orgId, filterIds); + jugrix.deepPersonIds(orgId, filterIds); + jugrix.isActive(personId); + jugrix.parentOrganizationIds(orgId, filterIds); + jugrix.personIds(orgId, filterIds); + jugrix.roleDescriptionElementIds(orgId, filterIds); + jugrix.roleIds(orgId); + jugrix.rolePriority(personId, "r:34"); + jugrix.stringPathToId("r:path:エスアールエルテクノシステム/臨検システム部/業務システムグループ"); + } +}
--- a/src/main/java/ac/jp/u_ryukyu/cr/ie/tatsuki/xmlReader/ReadXmlPutAttributeCreateIndex.java Tue Nov 11 19:01:36 2014 +0900 +++ b/src/main/java/ac/jp/u_ryukyu/cr/ie/tatsuki/xmlReader/ReadXmlPutAttributeCreateIndex.java Thu Nov 13 23:34:41 2014 +0900 @@ -73,23 +73,22 @@ @Override public void characters(char[] ch, int start, int length) { - String str = new String(ch, start, length); - Pattern pattern = Pattern.compile("\n"); - Matcher macher = pattern.matcher(str); - - if (!macher.find()) { - if (str.equals("r:63 r:3 r:9")) - System.out.println("aaa"); - String[] splitStrs = str.split(" "); - for (String splitStr : splitStrs) { + String str = new String(ch, start, length); + Pattern pattern = Pattern.compile("\n"); + Matcher macher = pattern.matcher(str); + + if (!macher.find()) { + String[] splitStrs = str.split(" "); + for (String splitStr : splitStrs) { Pair<Integer, NodePath> nodePair = path.last(); NodePath onePath = nodePair.right(); - Either<Error, JungleTreeEditor> newEither = editor.putAttribute(onePath, "text-" + elementName, ByteBuffer.wrap(splitStr.getBytes())); + Either<Error, JungleTreeEditor> newEither = editor.putAttribute(onePath, "text-" + elementName, + ByteBuffer.wrap(splitStr.getBytes())); if (newEither.isA()) { - //error + // error } this.editor = newEither.b(); - } + } } }