# HG changeset patch # User sugi # Date 1366104367 -32400 # Node ID 3bcaf12cf8771f187d65278e4b3f7440228e16a0 # Parent 02783f3699b162c3d99926060f2060f5f1ec4e70 use MappedByteBuffer diff -r 02783f3699b1 -r 3bcaf12cf877 src/alice/test/codesegment/local/wordcount/CorrectResult.java --- a/src/alice/test/codesegment/local/wordcount/CorrectResult.java Tue Apr 16 15:09:47 2013 +0900 +++ b/src/alice/test/codesegment/local/wordcount/CorrectResult.java Tue Apr 16 18:26:07 2013 +0900 @@ -26,6 +26,8 @@ line_num +=result.line_num; word_num +=result.word_num; } + long t = System.currentTimeMillis(); + System.out.println(t - StartWordCount.t); System.out.println(line_num+" "+word_num); System.exit(0); diff -r 02783f3699b1 -r 3bcaf12cf877 src/alice/test/codesegment/local/wordcount/Range.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/codesegment/local/wordcount/Range.java Tue Apr 16 18:26:07 2013 +0900 @@ -0,0 +1,15 @@ +package alice.test.codesegment.local.wordcount; + +import org.msgpack.annotation.Message; + +@Message +public class Range { + + public int start; + public int end; + public Range(int _start, int _end) { + start = _start; + end = _end; + } + +} diff -r 02783f3699b1 -r 3bcaf12cf877 src/alice/test/codesegment/local/wordcount/SetTask.java --- a/src/alice/test/codesegment/local/wordcount/SetTask.java Tue Apr 16 15:09:47 2013 +0900 +++ b/src/alice/test/codesegment/local/wordcount/SetTask.java Tue Apr 16 18:26:07 2013 +0900 @@ -2,6 +2,8 @@ import alice.codesegment.CodeSegment; import java.io.*; +import java.nio.MappedByteBuffer; +import java.nio.channels.FileChannel; public class SetTask extends CodeSegment { @@ -13,6 +15,40 @@ @Override public void run() { + FileInputStream input; + try { + input = new FileInputStream(new File(conf.filename)); + FileChannel channel = input.getChannel(); + int length = (int)channel.size(); + MappedByteBuffer buffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, length); + ods.put("array", buffer); + int start=0,end=0,i=0; + int size = conf.division * 1024; + + for (;start+size