<compileReport>true</compileReport>
<modules>
<module>gwtquery.samples.JsCollectionVsJavaCollection</module>
-<!--
<module>gwtquery.samples.GwtQueryBench</module>
<module>gwtquery.samples.GwtQuerySample</module>
<module>gwtquery.samples.GwtQueryDemo</module>
<module>gwtquery.samples.GwtQueryEffects</module>
<module>gwtquery.samples.GwtQueryEffectsMin</module>
- <module>gwtquery.samples.GwtQueryWidgets</module>
<module>gwtquery.samples.GwtQueryImageZoom</module>
<module>gwtquery.samples.FadeEffectsSample</module>
<module>gwtquery.samples.SlideEffectsSample</module>
--->
</modules>
</configuration>
<executions>
</execution>
</executions>
</plugin>
- <plugin>
- <artifactId>maven-clean-plugin</artifactId>
- <configuration>
- <filesets>
- <fileset><directory>src/main/webapp/gwtquery.samples.GwtQueryBench</directory></fileset>
- <fileset><directory>src/main/webapp/gwtquery.samples.GwtQueryDemo</directory></fileset>
- <fileset><directory>src/main/webapp/gwtquery.samples.GwtQueryEffects</directory></fileset>
- <fileset><directory>src/main/webapp/gwtquery.samples.GwtQueryEffectsMin</directory></fileset>
- <fileset><directory>src/main/webapp/gwtquery.samples.GwtQueryPlugin</directory></fileset>
- <fileset><directory>src/main/webapp/gwtquery.samples.GwtQuerySample</directory></fileset>
- <fileset><directory>src/main/webapp/gwtquery.samples.GwtQueryWidgets</directory></fileset>
- <fileset><directory>src/main/webapp/gwtquery.samples.GwtQueryImageZoom</directory></fileset>
- <fileset><directory>src/main/webapp/test</directory></fileset>
- <fileset><directory>src/main/webapp/WEB-INF/classes</directory></fileset>
- <fileset><directory>tomcat</directory></fileset>
- <fileset><directory>www-test</directory></fileset>
- <fileset><directory>.gwt-tmp</directory></fileset>
- </filesets>
- </configuration>
- </plugin>
-
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
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.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.query.client.js.JsCache;
public class JsCollectionVsJavaCollection implements EntryPoint{
- public static final int MAX_ITEMS = 100000;
+ public static final int MAX_ITEMS = GWT.isScript() ? 100000 : 100;
public void onModuleLoad() {
-
Button b = new Button("run test");
b.addClickHandler(new ClickHandler() {
-
public void onClick(ClickEvent event) {
$(".gwt-label").remove();
testJsMapVsHashMap();
}
});
-
RootPanel.get().add(b);
-
}
public void testJsMapVsHashMap() {
- log("Testing jsMap");
-
- log("init phase");
+ log("-------------");
for (int i = 0; i < MAX_ITEMS; i++){
new String(""+i);
}
ellapsedTime = Duration.currentTimeMillis() - ellapsedTime;
log(" ellapsed Time : "+ellapsedTime);
- log("Testing cache : do "+MAX_ITEMS+" get in the cache :");
+ log("Testing cache : get "+MAX_ITEMS+" from the cache :");
ellapsedTime = Duration.currentTimeMillis();
for (int i = 0 ; i < MAX_ITEMS; i++){
int random = Random.nextInt(MAX_ITEMS);
ellapsedTime = Duration.currentTimeMillis() - ellapsedTime;
log(" ellapsed Time : "+ellapsedTime);
- log("Testing cache : do "+MAX_ITEMS+" exist (JsCache.exists() ) in the cache :");
+ log("Testing cache : run "+MAX_ITEMS+" exist() in the cache :");
ellapsedTime = Duration.currentTimeMillis();
for (int i = 0 ; i < MAX_ITEMS; i++){
int random = Random.nextInt(MAX_ITEMS);
ellapsedTime = Duration.currentTimeMillis() - ellapsedTime;
log(" ellapsed Time : "+ellapsedTime);
- log("Testing cache : get all keys :");
+ log("Testing cache : visit all keys() :");
ellapsedTime = Duration.currentTimeMillis();
for (String s: cache.keys()) {
}
ellapsedTime = Duration.currentTimeMillis() - ellapsedTime;
log(" ellapsed Time : "+ellapsedTime);
- log("Testing cache : get all values (JsCache.elements() ) :");
+ log("Testing cache : visit all values() :");
ellapsedTime = Duration.currentTimeMillis();
for (Object o: cache.elements()) {
}
log(" ellapsed Time : "+ellapsedTime);
totalTime = Duration.currentTimeMillis() - totalTime;
- log(" Total : "+ totalTime);
+ log(" Total : "+ totalTime + " ms.");
log("-------------");
log("");
ellapsedTime = Duration.currentTimeMillis() - ellapsedTime;
log(" ellapsed Time : "+ellapsedTime);
- log("Testing hashMap : do "+MAX_ITEMS+" get in the map :");
+ log("Testing hashMap : get "+MAX_ITEMS+" from the map :");
ellapsedTime = Duration.currentTimeMillis();
for (int i = 0 ; i < MAX_ITEMS; i++){
int random = Random.nextInt(MAX_ITEMS);
ellapsedTime = Duration.currentTimeMillis() - ellapsedTime;
log(" ellapsed Time : "+ellapsedTime);
- log("Testing hashMap : do "+MAX_ITEMS+" containsKey() :");
+ log("Testing hashMap : run "+MAX_ITEMS+" containsKey() in the map :");
ellapsedTime = Duration.currentTimeMillis();
for (int i = 0 ; i < MAX_ITEMS; i++){
int random = Random.nextInt(MAX_ITEMS);
ellapsedTime = Duration.currentTimeMillis() - ellapsedTime;
log(" ellapsed Time : "+ellapsedTime);
- log("Testing hashMap : get all keys :");
+ log("Testing hashMap : visit all keySet() :");
ellapsedTime = Duration.currentTimeMillis();
for (String s: hashMap.keySet()) {
}
ellapsedTime = Duration.currentTimeMillis() - ellapsedTime;
log(" ellapsed Time : "+ellapsedTime);
- log("Testing hashMap : get all values :");
+ log("Testing hashMap : visit all values() :");
ellapsedTime = Duration.currentTimeMillis();
for (Object o : hashMap.values()) {
}
log(" ellapsed Time : "+ellapsedTime);
totalTime = Duration.currentTimeMillis() - totalTime;
- log(" Total : "+ totalTime);
+ log(" Total : "+ totalTime + " ms.");
log("-------------");
}
-
-
-
public void log(String msg) {
RootPanel.get().add(new Label(msg));
}
-
}