i'm using Ubuntu 10.04 for GWT development and I noticed that on dev mode, the code runs faster on Firefox (in comparison to Chrome), but I'm thinking that even for Firefox there must be a version that runs faster, better for GWT Development mode
DevMode runs half in Java (outside the browser) and half in JavaScript (within the browser), with a bit of native code (the DevMode plugin) in between.
The reason Chrome is slower than Firefox is that the DevMode plugin runs in a sandbox, so calls and data have to cross the sandbox boundaries.
Now, whereas latest versions of browsers always perform better than previous ones, it shouldn't change much things wrt DevMode performance. What costs the most is crossing the Java/JavaScript boundaries, which requires chatting over the network (even if it's generally localhost).
For best performances, try the SuperDevMode, where everything runs in JavaScript in the browser: no plugin, no Java/JavaScript bridge over the netweork, just plain old JavaScript.
Related
Is it possible to keep the cache 'loaded' between recompiles?
Using auto-compile mode (play ~run) it calls out to several external APIs to build the response. If I am just tweaking code it is a pain to have to wait to rebuild the whole page every time.
That's the nature of development mode. The server is restarted for every recompile, and the EhCachePlugin is reinitialized. In production however, you shouldn't be using the EhCachePlugin anyway, as it not designed for a distributed environment (since each instance has it's own local cache).
I use the Play2-Memcached plugin for my production servers, and after a lot of similar frustration, I just decided to install memcached on my local machine and use that in development mode as well. I'm only kicking myself for not doing it sooner. It also comes with the added bonus of being able to flushall from the command line.
I'm building a web app with Backbone.js (I'm not tied to Backbone yet though). I need a back-end framework only for persistence to a database via a RESTful API. However, I also need to able to deploy it as a 'desktop' app for off-line use, i.e. running a local server and launching a browser window, but I don't want users to have to start a server from the command line to run the application.
I can use SQLite as a database since it's only a single user application, it's just the framework that I'm stuck on. I have looked at the following:
Rails and Django: Default web servers are too flimsy, requires Ruby/Python and runs from the command line. I'm aware of the Bitnami stacks but at 99mb it's too big of a dependency and not exactly hidden from the user.
Sproutcore: Run from command line, also too bulky.
Pyjamas Desktop - Depends on MSHTML which I suspect limits my ability to use HTML5 features.
I'm leaning towards creating a Java app that starts a Scala/Lift server instance and opens a web browser, then sits in the system tray (kind of like WAMP). Is anyone familiar with a tool or framework built for user-friendly deployment as a standalone desktop app?
I do not know if PHP is an option for you? Then I would recommend phpdock.
web2py has a standalone deploy-to-desktop feature with no dependency on Python: http://web2py.com/books/default/chapter/29/14#How-to-distribute-your-applications-as-binaries
As Eydun said, phpdock is an option but it's commercially licensed .
I settled on using Java/Spring/H2/Hibernate/Jetty. I find that Jetty serves requests VERY quickly so the application looks real-time when launched in a browser. There is a tutorial on embedding the Jetty server here. I imagine it's quite trivial to build a GUI that launches the server and a browser.
Another Java option is to use the Play Framework, which may be more at home to those coming from a Django/Rails background. However, the documentation for "creating a standalone version of your application" for Play 2.0+ indicates that they have ditched using Java EE containers (Tomcat/Jetty) and WAR files in favor of running the JARs with the bundled copy of JBoss Netty, so it may take a bit of work to get it running the way you want it.
I would recommend the Play Framework approach if you're OK with using/learning Scala.
I seem to recall seeing someone attach a Java debugger to a compiled / deployed GWT application in a screencast. Is this possible? I'm finding some sparse mentions of configuring a special "debug module" that extends your regular one, but details are thin.
Thanks!
You can use dev mode to debug deployed application BUT you will debug using your current code (from eclipse) instead of the deployed one. How? Just like with debugging on localhost, change url and it's done:
http://your-test-or-production-or-sth-server.com/application.html?gwt.codesvr=localhost:9997
This will let you debug real problems happening in the environment with real data and previously deployed gwt services (or ejb beans and other stuff). Just remember, that you are not debugging compiled gwt code, you're debugging the code you have used when starting dev mode. You can of course debug the version of the application deployed to the server (by checking out that version from your source control system), but there is no way to actually debug javascript in java (1) that I know of.
(1) - http://code.google.com/p/chromedevtools/
We do have problems with GWT hosted mode running in Eclipse Ganymede (Windwos XP 3GB RAM). When we start our application in hosted mode it takes very long to start and also the transactions once the application is started are taking minutes to react. It seems as if it takes very long to communicate between Javascript and server.
The processor shows almost no load during this time. Even compiling and starting from an external browser does not help.
Strange is that we do have two other computers (one Windows XP one Linux) with exact the same setup where the hosted mode is working at normal speed without any problems for the same application.
Do yourself a favour, move to GWT 2.0 (currently in RC2) and take advantage of Out Of Process Hosted Mode (OOPHM), which lets you debug straight in the browser, and is lightning fast!
http://code.google.com/p/google-web-toolkit/wiki/UsingOOPHM
Try removing all breakpoints. It helped me in such a scenario. Apparently if you place breakpoints in critical points in the program, it can cause everything to grind to nearly a halt in hosted mode.
I second the suggestion to switch to GWT 2. Please note, however, that with GWT 2, hosted mode is very slow in Chrome. I recently switched from 1.7 to 2.0 and found hosted mode to be very slow ... until I switched to Firefox. Reason for this is that Chrome's process model is not benificial to OOPHM, at least now.
A few ideas:
Does the slow Windows box have a heavily fragmented hard-drive?
Is it a specific database query that's taking a long time once the application is running, or are all interactions slow?
Are the project files on a local filesystem?
Is the database on a local filesystem?
If so, does it have the same size data set as the other machines?
If not, are they on different subnets or have different bandwidth available?
From what I've read/viewed online about using GWT, the key is to develop/debug in the Hosted Mode browser versus compiling and testing in normal browsers.
As a UI developer - the rendering engine is a key piece of the puzzle when using a custom/embedded browser.
Thus (since I can't find the info anywhere), what browser rendering engine is used by the Hosted Mode browser?
Gecko (e.g. Firefox)
Trident (e.g. Internet Explorer)
Webkit (e.g. Safari/Chrome)
And if known, which version of the engine? e.g. (the IE6 ver of IE), or (the 3.5.x ver of FF), etc.
Depending on your operating system GWT uses the following browser engines:
Windows: the IE engine of the IE version installed.
Mac: custom WebKit build.
Linux: FF 1.0.
With GWT 2.0 (which is not yet officially released) the hosted mode browser is replaced by plugins running in the browser, called Out of Process Hosted Mode (OOPHM) you can read more about it here: http://code.google.com/p/google-web-toolkit/wiki/DesignOOPHM.
For my UI development, most UI issues have to do with css. My development process consists of running in hosted mode to test the code (business logic) and compile to web mode to fix the CSS issues in different browsers, using browser plugins to dynamically alter the css.
GWT 2.0 should get you all fixed up. It will allow you to use each of the main browsers for debug. See this link for full details. In the past I'm pretty sure hosted mode used the native browser engine for the specific platform(safari on mac, ie on windows, mozilla on linux) but this may have changed to webkit recently.