Slow Start in DevMode

103 views
Skip to first unread message

Reto

unread,
Apr 6, 2012, 5:30:42 PM4/6/12
to gwt-validation
Hi,

In the developer mode of GWT, I experience around a 7s delay, when the
first use of the gwt-validation happens.
As far, as I can see, it has to do with the deferred binding and
happens during the configure() call when building the
validatorFactory.

ValidatorFactory factory =
Validation.byDefaultProvider().configure().buildValidatorFactory();

Does someone have an idea how to speed this up in DevMode?

Regards,
Reto

ABEGA Julien

unread,
Apr 9, 2012, 3:43:01 AM4/9/12
to gwt-val...@googlegroups.com
Hi, 

I think this is due to the Reflections api that scan your classpath the first time you 
call the API (it is the generator used by the deferred binding process that actually triggers the scan). 
There is a way to do this at build time (using maven for instance http://code.google.com/p/reflections/ )
and use the related generated metadata file at runtime. This means modifying the gwt-validation API  or maybe write another similar generator based on the one provided by the gwt-validation package. I am currently trying to find the best solution for me too.
cheers,

J.




--
You received this message because you are subscribed to the Google Groups "gwt-validation" group.
To post to this group, send email to gwt-val...@googlegroups.com.
To unsubscribe from this group, send email to gwt-validatio...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gwt-validation?hl=en.




--
Julien Abega
julien...@gmail.com
+33659473789

chris.r

unread,
Apr 9, 2012, 1:25:40 PM4/9/12
to gwt-val...@googlegroups.com
Hey,

I'm working on updating this so that you can specify a model package and not have to worry about doing complex excludes.

However, you can, and should look at the exclude mechanism and see if you can specify some packages you don't want.

See the following classes:
http://code.google.com/p/gwt-validation/source/browse/trunk/gwt-validation-core/src/main/java/com/em/validation/rebind/scan/ClassScanner.java 

I'm trying to think of a faster better way to essentially catalog all of the constraints and the constrained classes at compile time but nothing has come to me yet.

Good luck.

Chris

chris.r

unread,
Apr 9, 2012, 3:26:27 PM4/9/12
to gwt-val...@googlegroups.com
I just added a bit of an experimental feature in r325 that allows you to specify the model classes that you want scanned during that phase.  This doesn't really do a lot for me (from 1.2 seconds down to 0.9 seconds) but I suspect if you have a large classpath it might help you a great deal.

Here is the command line / system property: gwt.validation.included.ModelPackages

You must remember to at least do this:

-Dgwt.validation.included.ModelPackages=javax.validation.constraints,com.em.validation.client.constraints

If you do not do that it will just plain not work.  The built in constraints and the gwt-validation constraints won't be found and nothing will be properly scanned.  You will not get any classes in your model and nothing will validate properly.

You can see in the r325 pom (http://code.google.com/p/gwt-validation/source/browse/trunk/gwt-validation-core/pom.xml?spec=svn325&r=325) on line 143 how this is used in test mode.

Good luck.

Chris

Reto Grob

unread,
Apr 10, 2012, 5:42:45 AM4/10/12
to gwt-val...@googlegroups.com
Hi Chris,

I could just see r324 and there it did not work yet. I have about 15
seconds for the scan in Developer Mode - so a speed up would be great.
I tried downloading and using the latest source code but then I get
gwt compilation errors.

Can you provide the r325 version?

Regards,
Reto

> --
> You received this message because you are subscribed to the Google Groups
> "gwt-validation" group.

> To view this discussion on the web visit
> https://groups.google.com/d/msg/gwt-validation/-/W6ndep9v3JQJ.

chris.r

unread,
Apr 10, 2012, 11:55:48 AM4/10/12
to gwt-val...@googlegroups.com
I can add the r325 snapshot to the downloads section.  Did you have problems building that or just problems with the gwt compile? 
 
You said you have gwt compile errors.  Could you post those so that we can see if we can figure out what is wrong?  Thanks.
 
Keep in mind that to see any speedup in r325 you'll have to include that command line option detailed in the previous postings.
 
Good luck.

Reto Grob

unread,
Apr 11, 2012, 5:02:30 AM4/11/12
to gwt-val...@googlegroups.com
Hi Chris,

During gwt-compile, I get the error below.
In Dev-Mode it seems to work, I could get a rough 3x improvement from
15s to 5s in a first test.

Regards,
Reto


Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
[ERROR] An internal compiler exception occurred
com.google.gwt.dev.jjs.InternalCompilerException: Failed to get JNode
at com.google.gwt.dev.jjs.impl.TypeMap.get(TypeMap.java:140)
at com.google.gwt.dev.jjs.impl.TypeMap.get(TypeMap.java:71)
at com.google.gwt.dev.jjs.impl.BuildTypeMap.getType(BuildTypeMap.java:730)
at com.google.gwt.dev.jjs.impl.BuildTypeMap.process(BuildTypeMap.java:814)
at com.google.gwt.dev.jjs.impl.BuildTypeMap.access$700(BuildTypeMap.java:99)
at com.google.gwt.dev.jjs.impl.BuildTypeMap$BuildDeclMapVisitor.process(BuildTypeMap.java:325)
at com.google.gwt.dev.jjs.impl.BuildTypeMap$BuildDeclMapVisitor.visit(BuildTypeMap.java:244)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1198)
at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.traverse(CompilationUnitDeclaration.java:687)
at com.google.gwt.dev.jjs.impl.BuildTypeMap.createPeersForNonTypeDecls(BuildTypeMap.java:637)
at com.google.gwt.dev.jjs.impl.BuildTypeMap.exec(BuildTypeMap.java:514)
at com.google.gwt.dev.jjs.impl.BuildTypeMap.exec(BuildTypeMap.java:523)
at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:599)
at com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:33)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:284)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:233)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:145)
at com.google.gwt.dev.Compiler.run(Compiler.java:232)
at com.google.gwt.dev.Compiler.run(Compiler.java:198)
at com.google.gwt.dev.Compiler$1.run(Compiler.java:170)
at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:88)
at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:82)
at com.google.gwt.dev.Compiler.main(Compiler.java:177)
[ERROR] <no source info>: public abstract class
com.google.gwt.junit.client.GWTTestCase
extends junit.framework.TestCase
/* fields */
public static final [unresolved] Map<java.lang.String,Unresolved type
com.google.gwt.junit.client.GWTTestCase$TestModuleInfo> ALL_GWT_TESTS
private static final [unresolved] java.lang.Object ALL_GWT_TESTS_LOCK
private [unresolved] boolean forcePureJava
private [unresolved] Unresolved type
com.google.gwt.junit.JUnitShell$Strategy strategy
protected [unresolved] Unresolved type junit.framework.TestResult testResult
/* methods */
public void <init>()
[unresolved] public final void addCheckpoint(java.lang.String)
[unresolved] public boolean catchExceptions()
[unresolved] public final void clearCheckpoints()
[unresolved] protected Unresolved type
com.google.gwt.junit.JUnitShell$Strategy createStrategy()
[unresolved] protected final void delayTestFinish(int)
[unresolved] protected final void finishTest()
[unresolved] public static java.lang.String[] getAllTestModuleNames()
[unresolved] public final java.lang.String[] getCheckpoints()
[unresolved] public static int getModuleCount()
public abstract java.lang.String getModuleName()
[unresolved] public Unresolved type
com.google.gwt.junit.JUnitShell$Strategy getStrategy()
[unresolved] public final java.lang.String getSyntheticModuleName()
[unresolved] public static Unresolved type
com.google.gwt.junit.client.GWTTestCase$TestModuleInfo
getTestsForModule(java.lang.String)
[unresolved] protected void gwtSetUp() throws java.lang.Exception
[unresolved] protected void gwtTearDown() throws java.lang.Exception
[unresolved] public boolean isPureJava()
public final void run(junit.framework.TestResult)
protected void runTest() throws java.lang.Throwable
[unresolved] public void setForcePureJava(boolean)
public void setName(java.lang.String)
protected final void setUp() throws java.lang.Exception
[unresolved] protected boolean supportsAsync()
protected final void tearDown() throws java.lang.Exception
/* members */
Unresolved type com.google.gwt.junit.client.GWTTestCase$TestModuleInfo
Unresolved type com.google.gwt.junit.client.GWTTestCase$BaseStrategy

org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding
[ERROR] at GwtValidationBaseTestCase.java(33): class
GwtValidationBaseTestCase
com.google.gwt.dev.jjs.ast.JClassType

chris.r

unread,
Apr 11, 2012, 2:11:04 PM4/11/12
to gwt-val...@googlegroups.com
Can you try and figure out why your dev-mode would be using GwtValidationBaseTest for anything?  That should not be used during the compile process at all.  I'll look at it here on my end to see if I mucked up a dependency/import.

coderinabstract

unread,
Jul 11, 2012, 3:35:51 AM7/11/12
to gwt-val...@googlegroups.com
Can something analogous to Guice binding (configuration module) or Spring annotation configuration for @Configurable package scans to work for specifying model packages? It would be realy good to modulariz this for larger apps and their dependent modules/jars for a better loosely coupled clean design.

Your thoughts

Thanks

Reply all
Reply to author
Forward
0 new messages