use of org.whole.lang.models.codebase.BPELModel in project whole by wholeplatform.
the class XmlPrettyPrinterBuilderTest method _testPerformance.
public void _testPerformance() {
IEntity model = new BPELModel().create();
PrintStream nullPrintStream = new PrintStream(new OutputStream() {
@Override
public void write(int b) throws IOException {
// do nothing
}
});
try {
long timestamp = new Date().getTime();
for (int i = 0; i < 1000; i++) {
XmlPrettyPrinterBuilderOperation op = new XmlPrettyPrinterBuilderOperation(new PrintWriter(nullPrintStream));
XmlStoreProducerBuilderOperation xmlOp = new XmlStoreProducerBuilderOperation(op);
((XmlStoreProducerBuilder) xmlOp.wGetBuilder()).buildStartDocument();
new ModelTemplate(model).apply(xmlOp);
((XmlStoreProducerBuilder) xmlOp.wGetBuilder()).buildEndDocument();
}
long timediff = new Date().getTime() - timestamp;
System.out.println("PrettyPrinterBuilder elapsed time: " + timediff + "ms");
timestamp = new Date().getTime();
for (int i = 0; i < 1000; i++) XmlBuilderPersistenceKit.instance().writeModel(model, new StreamPersistenceProvider(nullPrintStream));
timediff = new Date().getTime() - timestamp;
System.out.println("PrettyPrinterVisitor elapsed time: " + timediff + "ms");
} catch (Exception e) {
fail();
}
}
Aggregations