[357643] Performance improvement for large pages (debug code)
diff --git a/plugins/org.eclipse.actf.visualization.engines.blind.html/src/org/eclipse/actf/visualization/engines/blind/html/VisualizeEngine.java b/plugins/org.eclipse.actf.visualization.engines.blind.html/src/org/eclipse/actf/visualization/engines/blind/html/VisualizeEngine.java index 9b49c9c..371e4a7 100644 --- a/plugins/org.eclipse.actf.visualization.engines.blind.html/src/org/eclipse/actf/visualization/engines/blind/html/VisualizeEngine.java +++ b/plugins/org.eclipse.actf.visualization.engines.blind.html/src/org/eclipse/actf/visualization/engines/blind/html/VisualizeEngine.java
@@ -67,6 +67,8 @@ private static final String CHECK_ITEM_PATTERN = "B_\\p{Digit}+"; //$NON-NLS-1$ + private static final boolean DEBUG = false; + private String baseUrl = ""; // default value //$NON-NLS-1$ private String targetUrl = ""; //$NON-NLS-1$ @@ -155,23 +157,31 @@ // TODO move to screen reader engine DocumentCleaner.removeDisplayNone(document); - DebugPrintUtil.devOrDebugPrintln("remove display none\t" + (new Date()).getTime()); - + if (DEBUG) + DebugPrintUtil.debugPrintln("remove display none\t" + + (new Date()).getTime()); + orig = document; result = (Document) document.cloneNode(true); - DebugPrintUtil.devOrDebugPrintln("clone node\t" + (new Date()).getTime()); - + if (DEBUG) + DebugPrintUtil.debugPrintln("clone node\t" + + (new Date()).getTime()); + jwatc.setDocument(result); - - DebugPrintUtil.devOrDebugPrintln("jwatc\t" + (new Date()).getTime()); + + if (DEBUG) + DebugPrintUtil + .debugPrintln("jwatc\t" + (new Date()).getTime()); pageData = new PageData(); mapData = new VisualizeMapDataImpl(); VisualizeMapUtil.createNode2NodeMap(document, result, mapData); - - DebugPrintUtil.devOrDebugPrintln("create node2node map\t" + (new Date()).getTime()); + + if (DEBUG) + DebugPrintUtil.debugPrintln("create node2node map\t" + + (new Date()).getTime()); } @@ -204,45 +214,53 @@ problems = new Vector<IProblemItem>(); allPc = jwatc.getPacketCollection(); - DebugPrintUtil.devOrDebugPrintln("packet collection\t" + (new Date()).getTime()); - + DebugPrintUtil.debugPrintln("packet collection\t" + + (new Date()).getTime()); + cleanupPacketCollection(allPc); - DebugPrintUtil.devOrDebugPrintln("cleanup packet collection\t" + (new Date()).getTime()); + DebugPrintUtil.debugPrintln("cleanup packet collection\t" + + (new Date()).getTime()); ParamBlind curParamBlind = ParamBlind.getInstance(); // get packet and create map and list NodeInfoCreator nodeInfoCreator = new NodeInfoCreator(mapData, textChecker, problems, invisibleIdSet, curParamBlind); - - DebugPrintUtil.devOrDebugPrintln("Nodeinfo init\t" + (new Date()).getTime()); + + DebugPrintUtil.debugPrintln("Nodeinfo init\t" + + (new Date()).getTime()); nodeInfoCreator.prepareNodeInfo(allPc); - - DebugPrintUtil.devOrDebugPrintln("Nodeinfo prep\t" + (new Date()).getTime()); + + DebugPrintUtil.debugPrintln("Nodeinfo prep\t" + + (new Date()).getTime()); nodeInfoCreator.createAdditionalNodeInfo(result); - - DebugPrintUtil.devOrDebugPrintln("Nodeinfo additional\t" + (new Date()).getTime()); + + DebugPrintUtil.debugPrintln("Nodeinfo additional\t" + + (new Date()).getTime()); // link analysis preparation LinkAnalyzer linkAnalyzer = new LinkAnalyzer(result, allPc, mapData, problems, invisibleIdSet, curParamBlind, pageData); - DebugPrintUtil.devOrDebugPrintln("link analyzer\t" + (new Date()).getTime()); + DebugPrintUtil.debugPrintln("link analyzer\t" + + (new Date()).getTime()); styleInfo = new VisualizeStyleInfo(orig, mapData); - DebugPrintUtil.devOrDebugPrintln("style info\t" + (new Date()).getTime()); + DebugPrintUtil.debugPrintln("style info\t" + + (new Date()).getTime()); /* * rewrite DOM from here */ // insert ID attributes to elements mapData.makeIdMapping(Html2ViewMapData.ACTF_ID); - - DebugPrintUtil.devOrDebugPrintln("id mapping\t" + (new Date()).getTime()); + + DebugPrintUtil.debugPrintln("id mapping\t" + + (new Date()).getTime()); styleInfo.setImportedCssSet(DocumentCleaner.removeCSS(result, targetUrl)); @@ -261,21 +279,24 @@ mapData, curParamBlind); colorUtil.setColorAll(); - DebugPrintUtil.devOrDebugPrintln("color\t" + (new Date()).getTime()); - + DebugPrintUtil + .debugPrintln("color\t" + (new Date()).getTime()); + calMaxTime(); - DebugPrintUtil.devOrDebugPrintln("max time\t" + (new Date()).getTime()); - + DebugPrintUtil.debugPrintln("max time\t" + + (new Date()).getTime()); + problems.addAll(linkAnalyzer.skipLinkCheck(iMaxTime, iMaxTimeLeaf)); - DebugPrintUtil.devOrDebugPrintln("skiplink check\t" + (new Date()).getTime()); + DebugPrintUtil.debugPrintln("skiplink check\t" + + (new Date()).getTime()); replaceImgAndCheck(result, mapData, curParamBlind.oReplaceImage); - DebugPrintUtil.devOrDebugPrintln("image check\t" + (new Date()).getTime()); + DebugPrintUtil.debugPrintln("image check\t" + + (new Date()).getTime()); - int errorCount = 0; int missing = 0; int wrong = 0; @@ -320,8 +341,9 @@ VisualizeViewUtil .visualizeError(result, problems, mapData, baseUrl); - DebugPrintUtil.devOrDebugPrintln("error visualization\t" + (new Date()).getTime()); - + DebugPrintUtil.debugPrintln("error visualization\t" + + (new Date()).getTime()); + DocumentCleaner.removeJavaScript(mapData.getNodeInfoList(), result); DocumentCleaner.removeMeta(result); DocumentCleaner.removeObject(result); @@ -330,11 +352,13 @@ DocumentCleaner.removeBase(result); DocumentCleaner.removePI(result); - DebugPrintUtil.devOrDebugPrintln("document cleaner\t" + (new Date()).getTime()); - + DebugPrintUtil.debugPrintln("document cleaner\t" + + (new Date()).getTime()); + VisualizationResultCleaner.clean(result, targetUrl); - - DebugPrintUtil.devOrDebugPrintln("result cleaner\t" + (new Date()).getTime()); + + DebugPrintUtil.debugPrintln("result cleaner\t" + + (new Date()).getTime()); // TODO merge with visualizeError Id2LineViaActfId id2line = null; @@ -343,8 +367,9 @@ html2viewMapV); } - DebugPrintUtil.devOrDebugPrintln("id2line\t" + (new Date()).getTime()); - + DebugPrintUtil.debugPrintln("id2line\t" + + (new Date()).getTime()); + for (IProblemItem i : problems) { BlindProblem tmpBP = (BlindProblem) i; tmpBP.prepareHighlight();