use of net.vtst.ow.closure.compiler.deps.AstFactoryFromModifiable in project ow by vtst.
the class MainForDebug method measureTime.
public static void measureTime() {
final ArrayList<File> listFiles = new ArrayList<File>();
final ArrayList<JSSourceFile> listSourceFiles = new ArrayList<JSSourceFile>();
final ArrayList<AstFactoryFromModifiable> listAsts = new ArrayList<AstFactoryFromModifiable>();
FileTreeVisitor.Simple<RuntimeException> visitor = new FileTreeVisitor.Simple<RuntimeException>() {
public void visitFile(File file) {
if (!CompilerUtils.isJavaScriptFile(file))
return;
listFiles.add(file);
JSSourceFile sourceFile = JSSourceFile.fromFile(file);
listSourceFiles.add(sourceFile);
//listAsts.add(new JsAstFactoryFromFile(file));
}
};
visitor.visit(new File("/home/vtst/test/out/goog"));
System.out.println(listAsts.size());
long t0 = System.nanoTime();
long t1 = 0;
for (int i = 0; i < 10; ++i) {
if (i == 1)
t1 = System.nanoTime();
JSModule module = new JSModule("main");
for (AstFactoryFromModifiable ast : listAsts) {
module.add(new CompilerInput(ast.getClone(false)));
}
// for (JSSourceFile sourceFile: listSourceFiles) {
// module.add(new CompilerInput(sourceFile));
// }
// for (File file: listFiles) {
// module.add(new CompilerInput(JSSourceFile.fromFile(file)));
// }
Compiler compiler = CompilerUtils.makeCompiler(CompilerUtils.makePrintingErrorManager(System.out));
CompilerOptions options = CompilerUtils.makeOptionsForParsingAndErrorReporting();
options.checkTypes = true;
compiler.compile(new JSSourceFile[] {}, new JSModule[] { module }, options);
System.out.println(compiler.toSource().length());
}
long tf = System.nanoTime();
System.out.println((tf - t0) * 1e-9);
System.out.println((tf - t1) * 1e-9);
System.out.println("DONE");
}
Aggregations