📄 performance.java
字号:
{
"testing/arp/onts/ont118",
"http://www.cs.umd.edu/projects/plus/DAML/onts/univ1.0.daml" },
{
"testing/arp/onts/ont119",
"http://www.cs.umd.edu/~golbeck/daml/baseball.daml" },
{
"testing/arp/onts/ont120",
"http://www.cs.umd.edu/~golbeck/daml/running.daml" },
{
"testing/arp/onts/ont121",
"http://www.cs.umd.edu/~golbeck/daml/vegetarian.daml" },
{
"testing/arp/onts/ont122",
"http://www.cs.yale.edu/~dvm/daml/agent-ont.daml" },
{
"testing/arp/onts/ont123",
"http://www.cs.yale.edu/~dvm/daml/bib-ont.daml" },
{
"testing/arp/onts/ont124",
"http://www.cs.yale.edu/~dvm/daml/drsonto.daml" },
{
"testing/arp/onts/ont125",
"http://www.cs.yale.edu/~dvm/daml/exp-ont.daml" },
{
"testing/arp/onts/ont126",
"http://www.cs.yale.edu/~dvm/daml/pddlonto.daml" },
{
"testing/arp/onts/ont127",
"http://www.cyc.com/2002/04/08/cyc.daml" },
{
"testing/arp/onts/ont129",
"http://www.daml.org/2000/10/daml-ont" },
{
"testing/arp/onts/ont130",
"http://www.daml.org/2000/12/daml+oil" },
{
"testing/arp/onts/ont131",
"http://www.daml.org/2001/01/gedcom/gedcom.daml" },
{
"testing/arp/onts/ont132",
"http://www.daml.org/2001/02/geofile/geofile-ont.daml" },
{
"testing/arp/onts/ont133",
"http://www.daml.org/2001/02/projectplan/projectplan.daml" },
{
"testing/arp/onts/ont134",
"http://www.daml.org/2001/03/daml+oil" },
{
"testing/arp/onts/ont135",
"http://www.daml.org/2001/06/itinerary/itinerary-ont.daml" },
{
"testing/arp/onts/ont136",
"http://www.daml.org/2001/06/map/map-ont" },
{
"testing/arp/onts/ont137",
"http://www.daml.org/2001/08/baseball/baseball-ont" },
{
"testing/arp/onts/ont138",
"http://www.daml.org/2001/10/agenda/agenda-ont" },
{
"testing/arp/onts/ont139",
"http://www.daml.org/2001/12/factbook/factbook-ont" },
{
"testing/arp/onts/ont140",
"http://www.daml.org/ontologies/ontologies-ont" },
{
"testing/arp/onts/ont141",
"http://www.daml.org/projects/integration/projects-20010811" },
{
"testing/arp/onts/ont142",
"http://www.daml.org/tools/tools-ont" },
{
"testing/arp/onts/ont143",
"http://www.daml.ri.cmu.edu/ont/AirportCodes.daml" },
{
"testing/arp/onts/ont144",
"http://www.daml.ri.cmu.edu/ont/homework/atlas-cmu.daml" },
{
"testing/arp/onts/ont145",
"http://www.daml.ri.cmu.edu/ont/homework/atlas-date.daml" },
{
"testing/arp/onts/ont146",
"http://www.daml.ri.cmu.edu/ont/homework/atlas-employment_categories.daml" },
{
"testing/arp/onts/ont147",
"http://www.daml.ri.cmu.edu/ont/homework/atlas-publications.daml" },
{
"testing/arp/onts/ont148",
"http://www.daml.ri.cmu.edu/ont/homework/cmu-ri-center-ont.daml" },
{
"testing/arp/onts/ont149",
"http://www.daml.ri.cmu.edu/ont/homework/cmu-ri-courses-ont.daml" },
{
"testing/arp/onts/ont150",
"http://www.daml.ri.cmu.edu/ont/homework/cmu-ri-employmenttypes-ont.daml" },
{
"testing/arp/onts/ont151",
"http://www.daml.ri.cmu.edu/ont/homework/cmu-ri-labgroup-ont.daml" },
{
"testing/arp/onts/ont152",
"http://www.daml.ri.cmu.edu/ont/homework/cmu-ri-people-ont.daml" },
{
"testing/arp/onts/ont153",
"http://www.daml.ri.cmu.edu/ont/homework/cmu-ri-project-ont.daml" },
{
"testing/arp/onts/ont154",
"http://www.daml.ri.cmu.edu/ont/homework/cmu-ri-publications-ont.daml" },
{
"testing/arp/onts/ont155",
"http://www.daml.ri.cmu.edu/ont/USCity.daml" },
{
"testing/arp/onts/ont156",
"http://www.daml.ri.cmu.edu/ont/USRegionState.daml" },
{
"testing/arp/onts/ont157",
"http://www.davincinetbook.com:8080/daml/rdf/homework3/projectGutenbergOnt.daml" },
{
"testing/arp/onts/ont161",
"http://www.isi.edu/webscripter/bibtex.o.daml" },
{
"testing/arp/onts/ont162",
"http://www.isi.edu/webscripter/communityreview/abstract-review-o" },
{
"testing/arp/onts/ont163",
"http://www.isi.edu/webscripter/communityreview/scientific-review-o" },
{
"testing/arp/onts/ont164",
"http://www.isi.edu/webscripter/division.o.daml" },
{
"testing/arp/onts/ont165",
"http://www.isi.edu/webscripter/document.o.daml" },
{
"testing/arp/onts/ont166",
"http://www.isi.edu/webscripter/event.o.daml" },
{
"testing/arp/onts/ont167",
"http://www.isi.edu/webscripter/person.o.daml" },
{
"testing/arp/onts/ont168",
"http://www.isi.edu/webscripter/project.o.daml" },
{
"testing/arp/onts/ont169",
"http://www.isi.edu/webscripter/publication.o.daml" },
{
"testing/arp/onts/ont170",
"http://www.isi.edu/webscripter/snapshot.o.daml" },
{
"testing/arp/onts/ont171",
"http://www.isi.edu/webscripter/todo.o.daml" },
{
"testing/arp/onts/ont172",
"http://www.kestrel.edu/DAML/2000/12/CAPACITY.daml" },
{
"testing/arp/onts/ont173",
"http://www.kestrel.edu/DAML/2000/12/DEMAND.daml" },
{
"testing/arp/onts/ont174",
"http://www.kestrel.edu/DAML/2000/12/instances.daml" },
{
"testing/arp/onts/ont175",
"http://www.kestrel.edu/DAML/2000/12/OPERATION.daml" },
{
"testing/arp/onts/ont176",
"http://www.kestrel.edu/DAML/2000/12/RESOURCE.daml" },
{
"testing/arp/onts/ont177",
"http://www.kestrel.edu/DAML/2000/12/TIME.daml" },
{
"testing/arp/onts/ont178",
"http://www.ksl.stanford.edu/projects/DAML/ksl-daml-desc.daml" },
{
"testing/arp/onts/ont179",
"http://www.ksl.stanford.edu/projects/DAML/ksl-daml-instances.daml" },
{
"testing/arp/onts/ont181",
"http://www.lgi2p.ema.fr/~ranwezs/ontologies/musicV1.0.daml" },
{
"testing/arp/onts/ont182",
"http://www.lgi2p.ema.fr/~ranwezs/ontologies/soccerV2.0.daml" },
{
"testing/arp/onts/ont183",
"http://www.semanticweb.org/library/wordnet/wordnet-20000620.rdfs" },
{
"testing/arp/onts/ont184",
"http://www.semanticweb.org/ontologies/swrc-onto-2000-09-10.daml" },
{
"testing/arp/onts/ont185",
"http://www.w3.org/2000/10/annotation-ns#" },
{
"testing/arp/onts/ont186",
"http://www.w3.org/2000/10/annotationType#" },
{
"testing/arp/onts/ont187",
"http://www.w3.org/2000/10/swap/infoset/infoset-diagram.rdf" },
{
"testing/arp/onts/ont188",
"http://www.w3.org/2000/10/swap/pim/contact.rdf" },
{
"testing/arp/onts/ont189",
"http://www.w3.org/2000/10/swap/pim/doc.rdf" },
{
"testing/arp/onts/ont190",
"http://www.w3.org/2001/03/earl/0.95.rdf" },
{
"testing/arp/onts/ont191", "http://www.w3.org/2001/03/thread" }, {
"testing/arp/onts/ont192",
"http://www.w3.org/2001/05/rdf-ds/datastore-schema" },
*/
};
static String files[][];
static int totalLength;
static int totalTime;
static public void main(String args[]) {
int k;
files = new String[20][];
for (int ii = 0;
ii + files.length <= allFiles.length;
ii += files.length) {
for (k = 0; k < files.length; k++)
files[k] = allFiles[ii+k];
totalLength = 0;
double s1 = speed();
double s2 = speed();
System.err.println(
files[0][0]
+ "\t"
+ totalLength
+ "\t"
+ s1 +"\t" + s2
+ "\t"
+ files[0][1]);
}
System.err.println("Total time: " + totalTime + " ms");
}
static byte[][] load() {
byte rslt[][] = new byte[files.length][];
for (int i = 0; i < files.length; i++) {
File f = new File(files[i][0]);
totalLength += (int) f.length();
if (f.length() == 0)
continue;
rslt[i] = new byte[(int) f.length()];
try {
InputStream in = new FileInputStream(f);
in.read(rslt[i]);
in.close();
} catch (IOException e) {
System.err.println(files[i][1] + " " + e.getMessage());
}
}
return rslt;
}
static int sum(byte array[]) {
int r = 0;
if (array == null)
return 0;
for (int i = 0; i < array.length; i++)
r += array[i];
return r;
}
static double speed() {
boolean realData = false;
byte data[][] = load();
int s = 0;
long startRead = System.currentTimeMillis();
for (int i = 0; i < files.length; i++)
for (int k = 0; k < 50; k++)
s += sum(data[i]);
long startTest = System.currentTimeMillis();
for (int i = 0; i < files.length; i++)
try {
if (data[i] == null)
continue;
realData = true;
parseRDF(new ByteArrayInputStream(data[i]), files[i][1]);
} catch (IOException e) {
System.err.println("byteArray " + e.getMessage());
}
long endTime = System.currentTimeMillis();
totalTime += (int)(endTime-startTest);
if (!realData)
return Double.NaN;
return (double) (endTime - startTest)
/ (double) (startTest - startRead);
}
static void parseRDF(InputStream in, String base) throws IOException {
ErrorHandler eh = new ErrorHandler() {
public void warning(SAXParseException e) {
}
public void error(SAXParseException e) {
}
public void fatalError(SAXParseException e) {
}
};
InputStream oldIn = System.in;
InputStream ntIn = null;
try {
System.setIn(in);
NTriple.mainEh(
new String[] { "-b", base, "-t" },
eh, null);
} catch (Exception e) {
System.err.println(base + " " + e.toString());
} finally {
System.setIn(oldIn);
if (ntIn != null)
ntIn.close();
}
}
}
/*
* (c) Copyright 2003, 2004, 2005, 2006, 2007 Hewlett-Packard Development Company, LP
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -