Adds more widget creation benchmarks. to compare creating via innerHTML v. dom
calls, and empty dom structures v. similar structures with a bit of text.

Reviewed by jgw
http://gwt-code-reviews.appspot.com/129804

git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@7366 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/Microbenchmarks.java b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/Microbenchmarks.java
index 0f90a91..2f2cc81 100644
--- a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/Microbenchmarks.java
+++ b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/Microbenchmarks.java
@@ -15,6 +15,7 @@
  */
 package com.google.gwt.reference.microbenchmark.client;
 
+import com.google.gwt.core.client.Duration;
 import com.google.gwt.core.client.EntryPoint;
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.dom.client.Element;
@@ -45,10 +46,12 @@
       new WidgetCreation()
   };
 
+  double elapsedMs = 0;
   @UiField ListBox listBox;
   @UiField DeckPanel deck;
   @UiField Button button;
   @UiField Element running;
+  @UiField Element elapsed;
 
   @UiHandler("listBox")
   public void onChange(@SuppressWarnings("unused") ChangeEvent ignored) {
@@ -63,9 +66,13 @@
     button.setEnabled(false);
     DeferredCommand.addCommand(new Command() {
       public void execute() {
+        double start = Duration.currentTimeMillis();
         benchmarks[index].run();
         UIObject.setVisible(running, false);
         button.setEnabled(true);
+        double end = Duration.currentTimeMillis();
+        elapsedMs += end - start;
+        elapsed.setInnerText(Util.format(elapsedMs));
       }
     });
   }
diff --git a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/Microbenchmarks.ui.xml b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/Microbenchmarks.ui.xml
index fd314c7..30f5785 100644
--- a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/Microbenchmarks.ui.xml
+++ b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/Microbenchmarks.ui.xml
@@ -5,6 +5,7 @@
     <div style='margin-left:1em; margin-top:1em;'>
       Select Benchmark: <gwt:ListBox ui:field='listBox'/>
       <gwt:Button ui:field='button'>Run</gwt:Button>
+      <span ui:field='elapsed'></span>
       <span style="display:none; color:gray; font-style:oblique" 
         ui:field='running'>Running...</span>
     </div>
diff --git a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestCursorDomCrawl.java b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestCursorDomCrawl.java
index 872b603..0fbbe18 100644
--- a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestCursorDomCrawl.java
+++ b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestCursorDomCrawl.java
@@ -11,7 +11,7 @@
 public class TestCursorDomCrawl extends Widget {
   public static class Maker extends WidgetCreation.Maker {
     Maker() {
-      super("Complex UI via innerHTML, no widgets, get children by idealized crawl");
+      super("Text heavy UI via innerHTML, no widgets, get children by idealized crawl");
     }
     public Widget make() {
       return new TestCursorDomCrawl();
@@ -27,7 +27,7 @@
   SpanElement span2;
   
   private TestCursorDomCrawl() {
-    Element root = TestDom.fromHtml(TestDom.HTML);
+    Element root = Util.fromHtml(Util.TEXTY_OUTER_HTML);
     
     Element cursor = root;
     div1 = (cursor = cursor.getFirstChildElement()).cast();
diff --git a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestDom.java b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestDom.java
index 277f4e7..1ecadfe 100644
--- a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestDom.java
+++ b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestDom.java
@@ -27,35 +27,13 @@
 public class TestDom extends Widget {
   public static class Maker extends WidgetCreation.Maker {
     Maker() {
-      super("Complex UI via innerHTML, no widgets, get children by id");
+      super("Text heavy UI via innerHTML, no widgets, get children by id");
     }
     public Widget make() {
       return new TestDom();
     }
   }
 
-  static final String HTML = "<div>" 
-    +   "<div id='div1'>"
-    +     "<div id='div2'></div>" 
-    +     "<span id='span1'></span>" 
-    +   "</div>"
-    +   "<div>" 
-    +     "<div id='div3'>" 
-    +       "<div id='div4'></div>"
-    +       "<span id='span2'></span>" 
-    +     "</div>" 
-    +   "</div>" 
-    + "</div>";
-
-  private static final DivElement detachedDiv = Document.get().createDivElement();
-
-  static Element fromHtml(String html) {
-    detachedDiv.setInnerHTML(html);
-    Element e = detachedDiv.getFirstChildElement();
-    e.getParentElement().removeChild(e);
-    return e;
-  }
-  
   Element root;
   DivElement div1;
   DivElement div2;
@@ -67,7 +45,7 @@
   SpanElement span2;
 
   private TestDom() {
-    root = fromHtml(HTML);
+    root = Util.fromHtml(Util.TEXTY_OUTER_HTML);
     
     Document.get().getBody().appendChild(root);
     div1 = Document.get().getElementById("div1").cast();
diff --git a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestDomBinder.java b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestDomBinder.java
index 7960db9..9488543 100644
--- a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestDomBinder.java
+++ b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestDomBinder.java
@@ -30,7 +30,7 @@
 
   public static class Maker extends WidgetCreation.Maker {
     Maker() {
-      super("Complex UI via UiBinder, no widgets");
+      super("Text heavy UI via UiBinder, no widgets");
     }
     public Widget make() {
       return new TestDomBinder();
diff --git a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestDomBinder.ui.xml b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestDomBinder.ui.xml
index cc59343..592a756 100644
--- a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestDomBinder.ui.xml
+++ b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestDomBinder.ui.xml
@@ -1,16 +1,14 @@
 <ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'>
-      <div>
-        <div ui:field='div1'>
-          <div ui:field='div2'>
-          </div>
-          <span ui:field='span1'/>
-        </div>
-        <div>
-        <div ui:field='div3'>
-          <div ui:field='div4'>
-          </div>
-          <span ui:field='span2'/>
-        </div>
-      </div>
-      </div>
+  <div>Div root start
+    <div ui:field='div1'>Div1
+      <div ui:field='div2'>Div2</div>
+      <span ui:field='span1'>Span1</span>
+    Div1 end</div>
+    <div>Div anon start
+      <div ui:field='div3'>Div3
+        <div ui:field='div4'>Div4</div>
+        <span ui:field='span2'>Span2</span>
+      Div3 end</div>
+    Div anon end</div>
+  Div root end</div>
 </ui:UiBinder>
diff --git a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestDomViaApi.java b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestDomViaApi.java
new file mode 100644
index 0000000..e16ba30
--- /dev/null
+++ b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestDomViaApi.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.reference.microbenchmark.client;
+
+import com.google.gwt.dom.client.DivElement;
+import com.google.gwt.dom.client.Document;
+import com.google.gwt.dom.client.SpanElement;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Run by {@link WidgetCreation}, see {@link Maker#name} for details.
+ */
+public class TestDomViaApi extends Widget {
+  public static class Maker extends WidgetCreation.Maker {
+    Maker() {
+      super("Text heavy UI via DOM api calls, no widgets");
+    }
+
+    public Widget make() {
+      return new TestDomViaApi();
+    }
+  }
+
+  DivElement root;
+  DivElement div1;
+  DivElement div2;
+  DivElement div3;
+  DivElement div4;
+  SpanElement span1;
+  SpanElement span2;
+
+  private TestDomViaApi() {
+    Document d = Document.get();
+    root = d.createDivElement();
+    root.appendChild(d.createTextNode("Div root"));
+
+    div1 = d.createDivElement();
+    Util.addText(div1, "Div1");
+    root.appendChild(div1);
+
+    div2 = d.createDivElement();
+    Util.addText(div2, "Div2");
+    div1.appendChild(div2);
+
+    span1 = d.createSpanElement();
+    Util.addText(span1, "Span1");
+    div1.appendChild(span1);
+
+    DivElement anon = d.createDivElement();
+    Util.addText(anon, "Div anon");
+    root.appendChild(anon);
+
+    div3 = d.createDivElement();
+    Util.addText(div3, "Div3");
+    anon.appendChild(div3);
+
+    div4 = d.createDivElement();
+    Util.addText(div4, "Div4");
+    div3.appendChild(div4);
+
+    span2 = d.createSpanElement();
+    Util.addText(span2, "Span2");
+    div3.appendChild(span2);
+
+    Util.addText(div1, " Div1 end");
+    Util.addText(div3, " Div3 end");
+    Util.addText(anon, " Div anon end");
+    Util.addText(root, " Div root end");
+
+    setElement(root);
+  }
+}
diff --git a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestEmptyCursorDomCrawl.java b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestEmptyCursorDomCrawl.java
new file mode 100644
index 0000000..20a09bd
--- /dev/null
+++ b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestEmptyCursorDomCrawl.java
@@ -0,0 +1,50 @@
+package com.google.gwt.reference.microbenchmark.client;
+
+import com.google.gwt.dom.client.DivElement;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.SpanElement;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Run by {@link WidgetCreation}, see {@link Maker#name} for details.
+ */
+public class TestEmptyCursorDomCrawl extends Widget {
+  public static class Maker extends WidgetCreation.Maker {
+    Maker() {
+      super("Empty UI via innerHTML, no widgets, get children by idealized crawl");
+    }
+    public Widget make() {
+      return new TestEmptyCursorDomCrawl();
+    }
+  }
+
+  Element elm;
+  DivElement div1;
+  DivElement div2;
+  DivElement div3;
+  DivElement div4;
+  SpanElement span1;
+  SpanElement span2;
+  
+  private TestEmptyCursorDomCrawl() {
+    Element root = Util.fromHtml(Util.EMPTY_OUTER_HTML);
+    
+    Element cursor = root;
+    div1 = (cursor = cursor.getFirstChildElement()).cast();
+    assert div1.getId().equals("div1");
+    div2 = (cursor = cursor.getFirstChildElement()).cast();
+    assert div2.getId().equals("div2");
+    span1 = (cursor = cursor.getNextSiblingElement()).cast();
+    assert span1.getId().equals("span1");
+    
+    cursor = div1.getNextSiblingElement();
+    div3 = (cursor = cursor.getFirstChildElement()).cast();
+    assert div3.getId().equals("div3");
+    div4 = (cursor = cursor.getFirstChildElement()).cast();
+    assert div4.getId().equals("div4");
+    span2 = (cursor = cursor.getNextSiblingElement()).cast();
+    assert span2.getId().equals("span2");
+    
+    setElement(root);
+  }
+}
diff --git a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestEmptyDom.java b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestEmptyDom.java
new file mode 100644
index 0000000..b0a47be9
--- /dev/null
+++ b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestEmptyDom.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.reference.microbenchmark.client;
+
+import com.google.gwt.dom.client.DivElement;
+import com.google.gwt.dom.client.Document;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.SpanElement;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Run by {@link WidgetCreation}, see {@link Maker#name} for details.
+ */
+public class TestEmptyDom extends Widget {
+  public static class Maker extends WidgetCreation.Maker {
+    Maker() {
+      super("Empty UI via innerHTML, no widgets, get children by id");
+    }
+    public Widget make() {
+      return new TestEmptyDom();
+    }
+  }
+
+  Element root;
+  DivElement div1;
+  DivElement div2;
+  DivElement div3;
+
+  DivElement div4;
+  SpanElement span1;
+  
+  SpanElement span2;
+
+  private TestEmptyDom() {
+    root = Util.fromHtml(Util.EMPTY_OUTER_HTML);
+    
+    Document.get().getBody().appendChild(root);
+    div1 = Document.get().getElementById("div1").cast();
+    div2 = Document.get().getElementById("div2").cast();
+    div3 = Document.get().getElementById("div3").cast();
+    div4 = Document.get().getElementById("div4").cast();
+    span1 = Document.get().getElementById("span1").cast();
+    span2 = Document.get().getElementById("span2").cast();
+    
+    Document.get().getBody().removeChild(root);
+    div1.removeAttribute("id");
+    div2.removeAttribute("id");
+    div3.removeAttribute("id");
+    div4.removeAttribute("id");
+    span1.removeAttribute("id");
+    span2.removeAttribute("id");
+
+    setElement(root);
+  }
+}
diff --git a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestEmptyDomViaApi.java b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestEmptyDomViaApi.java
new file mode 100644
index 0000000..d3051fa
--- /dev/null
+++ b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestEmptyDomViaApi.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.reference.microbenchmark.client;
+
+import com.google.gwt.dom.client.DivElement;
+import com.google.gwt.dom.client.Document;
+import com.google.gwt.dom.client.SpanElement;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Run by {@link WidgetCreation}, see {@link Maker#name} for details.
+ */
+public class TestEmptyDomViaApi extends Widget {
+  public static class Maker extends WidgetCreation.Maker {
+    Maker() {
+      super("Empty UI via DOM api calls, no widgets");
+    }
+
+    public Widget make() {
+      return new TestEmptyDomViaApi();
+    }
+  }
+
+  DivElement root;
+  DivElement div1;
+  DivElement div2;
+  DivElement div3;
+  DivElement div4;
+  SpanElement span1;
+  SpanElement span2;
+
+  private TestEmptyDomViaApi() {
+    Document d = Document.get();
+    root = d.createDivElement();
+    root.appendChild(d.createTextNode("Div root"));
+
+    div1 = d.createDivElement();
+    root.appendChild(div1);
+
+    div2 = d.createDivElement();
+    div1.appendChild(div2);
+
+    span1 = d.createSpanElement();
+    div1.appendChild(span1);
+
+    DivElement anon = d.createDivElement();
+    root.appendChild(anon);
+
+    div3 = d.createDivElement();
+    anon.appendChild(div3);
+
+    div4 = d.createDivElement();
+    div3.appendChild(div4);
+
+    span2 = d.createSpanElement();
+    div3.appendChild(span2);
+
+    setElement(root);
+  }
+}
diff --git a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestEmptyRealisticDomCrawl.java b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestEmptyRealisticDomCrawl.java
new file mode 100644
index 0000000..e6d3e15
--- /dev/null
+++ b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestEmptyRealisticDomCrawl.java
@@ -0,0 +1,49 @@
+package com.google.gwt.reference.microbenchmark.client;
+
+import com.google.gwt.dom.client.DivElement;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.SpanElement;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Run by {@link WidgetCreation}, see {@link Maker#name} for details.
+ */
+public class TestEmptyRealisticDomCrawl extends Widget {
+  public static class Maker extends WidgetCreation.Maker {
+    Maker() {
+      super("Empty UI via innerHTML, no widgets, get children by nav from root");
+    }
+    public Widget make() {
+      return new TestEmptyRealisticDomCrawl();
+    }
+  }
+
+  Element elm;
+  DivElement div1;
+  DivElement div2;
+  DivElement div3;
+  DivElement div4;
+  SpanElement span1;
+
+  SpanElement span2;
+  
+  private TestEmptyRealisticDomCrawl() {
+    Element root = Util.fromHtml(Util.EMPTY_OUTER_HTML);
+
+    div1 = root.getFirstChildElement().cast();
+    assert div1.getId().equals("div1");
+    div2 = root.getFirstChildElement().getFirstChildElement().cast();
+    assert div2.getId().equals("div2");
+    span1 = root.getFirstChildElement().getFirstChildElement().getNextSiblingElement().cast();
+    assert span1.getId().equals("span1");
+    
+    div3 = root.getFirstChildElement().getNextSiblingElement().getFirstChildElement().cast();
+    assert div3.getId().equals("div3");
+    div4 = root.getFirstChildElement().getNextSiblingElement().getFirstChildElement().getFirstChildElement().cast();
+    assert div4.getId().equals("div4");
+    span2 = root.getFirstChildElement().getNextSiblingElement().getFirstChildElement().getFirstChildElement().getNextSiblingElement().cast();
+    assert span2.getId().equals("span2");
+    
+    setElement(root);
+  }
+}
diff --git a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestFlows.java b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestFlows.java
index ad94d49..c46b4f6 100644
--- a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestFlows.java
+++ b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestFlows.java
@@ -2,7 +2,7 @@
 
 import com.google.gwt.user.client.ui.Composite;
 import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.InlineLabel;
 import com.google.gwt.user.client.ui.Widget;
 
 /**
@@ -11,7 +11,7 @@
 public class TestFlows extends Composite {
   public static class Maker extends WidgetCreation.Maker {
     Maker() {
-      super("Complex UI via FlowPanels (DIVs) and Labels (SPANs)");
+      super("Text heavy UI via FlowPanels (DIVs) and InlineLabels (SPANs)");
     }
     public Widget make() {
       return new TestFlows();
@@ -20,23 +20,41 @@
   
   private TestFlows() {
     FlowPanel root = new FlowPanel();
+    Util.addText(root.getElement(), "Div root");
+    
     FlowPanel div1 = new FlowPanel();
-    FlowPanel div2 = new FlowPanel();
-    FlowPanel child2 = new FlowPanel();
-    FlowPanel div3 = new FlowPanel();
-    FlowPanel div4 = new FlowPanel();
-    Label span1 = new Label();
-    Label span2 = new Label();
-    
-    div1.add(div2);
-    div1.add(span1);
+    Util.addText(div1.getElement(), "Div1");
     root.add(div1);
-    
-    child2.add(div3);
+
+    FlowPanel div2 = new FlowPanel();
+    Util.addText(div2.getElement(), "Div2");
+    div1.add(div2);
+
+    InlineLabel span1 = new InlineLabel();
+    span1.setText("Span1");
+    div1.add(span1);
+
+    FlowPanel anon = new FlowPanel();
+    Util.addText(anon.getElement(), "Div anon");
+    root.add(anon);
+
+    FlowPanel div3 = new FlowPanel();
+    Util.addText(div3.getElement(), "Div3");
+    anon.add(div3);
+
+    FlowPanel div4 = new FlowPanel();
+    Util.addText(div4.getElement(), "Div4");
     div3.add(div4);
+
+    InlineLabel span2 = new InlineLabel();
+    span2.setText("Span2");
     div3.add(span2);
-    root.add(child2);
     
+    Util.addText(div1.getElement(), " Div1 end");
+    Util.addText(div3.getElement(), " Div3 end");
+    Util.addText(anon.getElement(), " Div anon end");
+    Util.addText(root.getElement(), " Div root end");
+
     initWidget(root);
   }
 }
diff --git a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestWidget.java b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestManualHTMLPanel.java
similarity index 78%
rename from reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestWidget.java
rename to reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestManualHTMLPanel.java
index 7f11fc2..3be721f 100644
--- a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestWidget.java
+++ b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestManualHTMLPanel.java
@@ -9,13 +9,13 @@
 /**
  * Run by {@link WidgetCreation}, see {@link Maker#name} for details.
  */
-public class TestWidget extends Composite {
+public class TestManualHTMLPanel extends Composite {
   public static class Maker extends WidgetCreation.Maker {
     Maker() {
-      super("Complex UI via typical manual HTMLPanel usage");
+      super("Text heavy UI via typical manual HTMLPanel usage");
     }
     public Widget make() {
-      return new TestWidget();
+      return new TestManualHTMLPanel();
     }
   }
   DivElement div1;
@@ -27,8 +27,8 @@
   
   SpanElement span2;
   
-  private TestWidget() {
-    HTMLPanel p = new HTMLPanel(TestDom.HTML);
+  private TestManualHTMLPanel() {
+    HTMLPanel p = new HTMLPanel(Util.TEXTY_INNER_HTML);
     initWidget(p);
     
     div1 = p.getElementById("div1").cast();
diff --git a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestRealisticDomCrawl.java b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestRealisticDomCrawl.java
index 26e3eb1..7100b63 100644
--- a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestRealisticDomCrawl.java
+++ b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestRealisticDomCrawl.java
@@ -11,7 +11,7 @@
 public class TestRealisticDomCrawl extends Widget {
   public static class Maker extends WidgetCreation.Maker {
     Maker() {
-      super("Complex UI via innerHTML, no widgets, get children by nav from root");
+      super("Text heavy UI via innerHTML, no widgets, get children by nav from root");
     }
     public Widget make() {
       return new TestRealisticDomCrawl();
@@ -28,7 +28,7 @@
   SpanElement span2;
   
   private TestRealisticDomCrawl() {
-    Element root = TestDom.fromHtml(TestDom.HTML);
+    Element root = Util.fromHtml(Util.TEXTY_OUTER_HTML);
 
     div1 = root.getFirstChildElement().cast();
     assert div1.getId().equals("div1");
diff --git a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestWidgetBinder.java b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestWidgetBinder.java
index 0177994..1b29c99 100644
--- a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestWidgetBinder.java
+++ b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestWidgetBinder.java
@@ -29,7 +29,7 @@
 public class TestWidgetBinder extends Composite {
   public static class Maker extends WidgetCreation.Maker {
     Maker() {
-      super("Complex UI with HTMLPanel via UiBinder");
+      super("Text heavy UI with HTMLPanel via UiBinder");
     }
     public Widget make() {
       return new TestWidgetBinder();
diff --git a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestWidgetBinder.ui.xml b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestWidgetBinder.ui.xml
index ebc0c6e..2bf108d 100644
--- a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestWidgetBinder.ui.xml
+++ b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/TestWidgetBinder.ui.xml
@@ -1,19 +1,15 @@
 <ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
   xmlns:gwt='urn:import:com.google.gwt.user.client.ui'>
-  <gwt:HTMLPanel>
-    <div>
-      <div ui:field='div1'>
-        <div ui:field='div2'>
-        </div>
-        <span ui:field='span1' />
-      </div>
-      <div>
-        <div ui:field='div3'>
-          <div ui:field='div4'>
-          </div>
-          <span ui:field='span2' />
-        </div>
-      </div>
-    </div>
-  </gwt:HTMLPanel>
+  <gwt:HTMLPanel>Div root start
+    <div ui:field='div1'>Div1
+      <div ui:field='div2'>Div2</div>
+      <span ui:field='span1'>Span1</span>
+    Div1 end</div>
+    <div>Div anon start
+      <div ui:field='div3'>Div3
+        <div ui:field='div4'>Div4</div>
+        <span ui:field='span2'>Span2</span>
+      Div3 end</div>
+    Div anon end</div>
+  Div root end</gwt:HTMLPanel>
 </ui:UiBinder>
diff --git a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/Util.java b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/Util.java
new file mode 100644
index 0000000..84fd4e0
--- /dev/null
+++ b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/Util.java
@@ -0,0 +1,64 @@
+package com.google.gwt.reference.microbenchmark.client;
+
+import com.google.gwt.dom.client.DivElement;
+import com.google.gwt.dom.client.Document;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.i18n.client.NumberFormat;
+
+class Util {
+  private static final DivElement detachedDiv = Document.get().createDivElement();
+
+  static final String EMPTY_OUTER_HTML = "<div>" + Util.EMPTY_INNER_HTML + "</div>";
+  
+  static final String EMPTY_INNER_HTML = "<div id='div1'>"
+    +     "<div id='div2'></div>" 
+    +     "<span id='span1'></span>" 
+    +   "</div>"
+    +   "<div>" 
+    +     "<div id='div3'>" 
+    +       "<div id='div4'></div>"
+    +       "<span id='span2'></span>" 
+    +     "</div>" 
+    +   "</div>";
+  
+  static final String TEXTY_OUTER_HTML = "<div>" + Util.TEXTY_INNER_HTML + "</div>";
+
+  static final String TEXTY_INNER_HTML = "Div root start" 
+  +   "<div id='div1'>Div1 start"
+  +     "<div id='div2'>Div2</div>" 
+  +     "<span id='span1'>Span1</span>" 
+  +   "Div1 end</div>"
+  +   "<div>Div anon start" 
+  +     "<div id='div3'>Div3" 
+  +       "<div id='div4'>Div4</div>"
+  +       "<span id='span2'>Span2</span>" 
+  +     "Div 3 end</div>" 
+  +   "Div anon end</div>"
+  + "Div root end";
+  
+  static void addText(Element elm, String text) {
+    elm.appendChild(Document.get().createTextNode(text));
+  }
+
+  static Element fromHtml(String html) {
+    Util.detachedDiv.setInnerHTML(html);
+    Element e = Util.detachedDiv.getFirstChildElement();
+    e.getParentElement().removeChild(e);
+    return e;
+  }
+
+  static long roundToTens(double median) {
+    return Math.round(median/10)*10;
+  }
+
+  static String format(double median) {
+    return NumberFormat.getFormat("0").format(median);
+  }
+
+  static String outerHtml(Element e) {
+    String string = "<" + e.getNodeName() + ">" 
+    + e.getInnerHTML()
+    + "</" + e.getNodeName() + ">";
+    return string;
+  }
+}
diff --git a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/WidgetCreation.java b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/WidgetCreation.java
index 00e83a0..12459ca 100644
--- a/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/WidgetCreation.java
+++ b/reference/Microbenchmarks/src/com/google/gwt/reference/microbenchmark/client/WidgetCreation.java
@@ -19,7 +19,6 @@
 import com.google.gwt.dom.client.Document;
 import com.google.gwt.event.dom.client.BlurEvent;
 import com.google.gwt.event.dom.client.BlurHandler;
-import com.google.gwt.i18n.client.NumberFormat;
 import com.google.gwt.user.client.Cookies;
 import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.Window.ClosingEvent;
@@ -27,6 +26,7 @@
 import com.google.gwt.user.client.ui.FlowPanel;
 import com.google.gwt.user.client.ui.Grid;
 import com.google.gwt.user.client.ui.HTMLPanel;
+import com.google.gwt.user.client.ui.InlineLabel;
 import com.google.gwt.user.client.ui.RootPanel;
 import com.google.gwt.user.client.ui.SimplePanel;
 import com.google.gwt.user.client.ui.TextBox;
@@ -75,9 +75,13 @@
         public Widget make() {
           return new HTMLPanel("");
         }
-      }, new EmptyBinder.Maker(), new TestDom.Maker(),
-      new TestCursorDomCrawl.Maker(), new TestRealisticDomCrawl.Maker(),
-      new TestDomBinder.Maker(), new TestFlows.Maker(), new TestWidget.Maker(),
+      }, new EmptyBinder.Maker(), new TestEmptyDomViaApi.Maker(),
+      new TestEmptyDom.Maker(), 
+      new TestEmptyCursorDomCrawl.Maker(),
+      new TestEmptyRealisticDomCrawl.Maker(),new TestDomViaApi.Maker(),
+      new TestDom.Maker(), new TestCursorDomCrawl.Maker(),
+      new TestRealisticDomCrawl.Maker(), new TestDomBinder.Maker(),
+      new TestFlows.Maker(), new TestManualHTMLPanel.Maker(),
       new TestWidgetBinder.Maker()};
 
   final private FlowPanel root;
@@ -112,7 +116,10 @@
     for (Maker m : makers) {
       grid.setText(row, 0, "0");
       grid.setText(row, 1, "0");
-      grid.setText(row, 2, m.name);
+      InlineLabel a = new InlineLabel();
+      a.setText(m.name);
+      a.setTitle(Util.outerHtml(m.make().getElement()));
+      grid.setWidget(row, 2, a);
       row++;
     }
 
@@ -170,10 +177,6 @@
     }
   }
 
-  private String format(double median) {
-    return NumberFormat.getFormat("0").format(median);
-  }
-
   private int getInstances() {
     try {
       int instances = Integer.parseInt(number.getValue());
@@ -185,7 +188,7 @@
 
   private void record(int row, double thisTime) {
     final int columns = grid.getColumnCount();
-    grid.setText(row, columns - 1, format(thisTime));
+    grid.setText(row, columns - 1, Util.format(thisTime));
 
     double max = 0, min = 0, mean = 0;
 
@@ -203,10 +206,10 @@
     double range = max - min;
     double halfRange = range / 2;
     double median = min + halfRange;
-    grid.setText(row, 0, format(median));
+    grid.setText(row, 0, Util.format(Util.roundToTens(median)));
 
     mean = mean / (columns - 3);
-    grid.setText(row, 1, format(mean));
+    grid.setText(row, 1, Util.format(Util.roundToTens(mean)));
   }
 
   @SuppressWarnings("deprecation")