Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 1359 → Rev 1360

/xmlparser_java/branches/003_cycle_buffer/CycleInputBuffer.java/XmlParser2.java
228,6 → 228,7
 
// == TEST METHODS =================================================================================================
private static void testDirectAccess(CycleInputBuffer buf)
throws Exception
{
for(int i = 0; !buf.isEnd(); ++i) {
byte c;
245,6 → 246,7
}
private static void testIndirectAccess(CycleInputBuffer buf)
throws Exception
{
for(int i = 0; !buf.isEnd(); ++i) {
byte c = buf.cur();
261,15 → 263,14
return;
}
 
long startTime;
String fileName = args[0];
FileInputStream in = null;
CycleBuffer buf;
String fileName = args[0];
FileInputStream in = null;
 
in = new FileInputStream(fileName);
try {
startTime = System.nanoTime();
CycleInputBuffer buf = new CycleInputBuffer(in);
long startTime = System.nanoTime();
CycleInputBuffer buf = new CycleInputBuffer(in);
testDirectAccess(buf);
System.out.println("Direct access: " + (System.nanoTime() - startTime) / 1000000 + "ms");
}
279,8 → 280,9
 
in = new FileInputStream(fileName);
try {
startTime = System.nanoTime();
CycleInputBuffer buf = new CycleInputBuffer(in);
long startTime = System.nanoTime();
CycleInputBuffer buf = new CycleInputBuffer(in);
 
testIndirectAccess(buf);
System.out.println("Indirect access: " + (System.nanoTime() - startTime) / 1000000 + "ms");
}