aboutsummaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
Diffstat (limited to 'samples')
-rw-r--r--samples/pom.xml24
-rw-r--r--samples/src/main/java/gwtquery/samples/client/JsCollectionVsJavaCollection.java35
-rw-r--r--samples/src/main/webapp/index.html2
3 files changed, 14 insertions, 47 deletions
diff --git a/samples/pom.xml b/samples/pom.xml
index b4a4a04a..5b7a3754 100644
--- a/samples/pom.xml
+++ b/samples/pom.xml
@@ -45,17 +45,14 @@
<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>
@@ -68,27 +65,6 @@
</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>
<configuration>
diff --git a/samples/src/main/java/gwtquery/samples/client/JsCollectionVsJavaCollection.java b/samples/src/main/java/gwtquery/samples/client/JsCollectionVsJavaCollection.java
index b4edf9e4..c5bacd46 100644
--- a/samples/src/main/java/gwtquery/samples/client/JsCollectionVsJavaCollection.java
+++ b/samples/src/main/java/gwtquery/samples/client/JsCollectionVsJavaCollection.java
@@ -6,6 +6,7 @@ import java.util.HashMap;
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;
@@ -18,29 +19,23 @@ import com.google.gwt.user.client.ui.RootPanel;
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);
}
@@ -56,7 +51,7 @@ public class JsCollectionVsJavaCollection implements EntryPoint{
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);
@@ -65,7 +60,7 @@ public class JsCollectionVsJavaCollection implements EntryPoint{
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);
@@ -74,14 +69,14 @@ public class JsCollectionVsJavaCollection implements EntryPoint{
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()) {
}
@@ -89,7 +84,7 @@ public class JsCollectionVsJavaCollection implements EntryPoint{
log(" ellapsed Time : "+ellapsedTime);
totalTime = Duration.currentTimeMillis() - totalTime;
- log(" Total : "+ totalTime);
+ log(" Total : "+ totalTime + " ms.");
log("-------------");
log("");
@@ -103,7 +98,7 @@ public class JsCollectionVsJavaCollection implements EntryPoint{
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);
@@ -112,7 +107,7 @@ public class JsCollectionVsJavaCollection implements EntryPoint{
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);
@@ -121,14 +116,14 @@ public class JsCollectionVsJavaCollection implements EntryPoint{
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()) {
}
@@ -136,16 +131,12 @@ public class JsCollectionVsJavaCollection implements EntryPoint{
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));
}
-
}
diff --git a/samples/src/main/webapp/index.html b/samples/src/main/webapp/index.html
index 743cda7c..d7160ec4 100644
--- a/samples/src/main/webapp/index.html
+++ b/samples/src/main/webapp/index.html
@@ -20,7 +20,7 @@
<li><a href="javascript:goTo('FadeEffectsSample/FadeEffectsSample.html')">FadeEffectsSample.html</a></li>
<li><a href="javascript:goTo('SlideEffectsSample/SlideEffectsSample.html')">SlideEffectsSample.html</a></li>
<li><a href="javascript:goTo('AnimationsSample/AnimationsSample.html')">AnimationsSample.html</a></li>
-
+<li><a href="javascript:goTo('JsCollectionVsJavaCollection/JsCollectionVsJavaCollection.html')">JsCollectionVsJavaCollection.html</a></li>
</ul>
</body>
</html>