Demo script (the one that is generated by new app generator) takes about 6 seconds to start on my SGS2. Is this a jRuby tax or is it me failing to install it properly (I am assuming rake install is the way)?

If it is just the way it is, then I am wondering whether an app that plays spinner 6 seconds longer than its rivals is of any value to anyone (genuine question - not trolling).

有帮助吗?

解决方案

The startup time is how it is now, so you are not doing anything wrong. The main part of the startup time is JRuby initialisation. Work is going on to speed this up, but you should not expect a major change in the near future.

There are several workarounds for the startup time.

You can add a pretty splash instead of the boring progress spinner. You do that by adding a splash.xml in res/layout/ . A nice splash will make startup seem shorter.

You can initialize the JRuby runtime before users start the app. One way is to start a service at boot by adding a broadcast receiver that listens for the BOOT_COMPLETED event. The service can be empty, but by starting the service, the JRuby runtime is initialized, and any activities started later will start within milliseconds. You can find an example of this here:

https://github.com/ruboto/ruboto/wiki/Tutorial%3A-Detect-and-display-the-connected-WIFI-network

You can let the initial activity of your app be Java based, and start the JRuby initialisation in the background. In that case JRuby will be initialised when the user selects the next activity.

What the actual impact of longer startup time is, I cannot say. Faster is better, but I use several Java based apps that take 10 seconds or more to start up, and for me it is not a show stopper. It depends heavily on the type of app.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top