Android acting really slowly (simulator and ios ok)

I just tried the lastest build, 1107, and it seems to be behaving better.  Give it a try and let me know if it seems better for you or if it’s just wishful thinking on my part.

Sorry about the late response.

I dove into this yesterday and discovered that our widget library is attempting to require-in a Lua file that isn’t there every time you create a new widget.  This is the cause of the performance issue.  It’s actually a performance issue on all platforms because file I/O is relatively expensive, and typically more expensive on Android because it involves peeking into the APK file which is really a zip file.

This issue started happening when we open sourced our widget library, because we modified it to support overriding our default/core implementation by adding a widget Lua library to your Corona project directory… in case you wanted to fork your own version based on what we have on bitbucket.

We did remove what was causing the “plugins.dex” warning, but that only reduced the performance issue by a tiny bit.  The real performance issue is still there.

We’ll look into solving this as soon as we can.

Thank you for the update Joshua.

Joshua, very good to hear that you are working on this. Looking forward to download a fixed daily build.

Good news! … holding breath :slight_smile:

Hate to nag but any idea on ETA for this fix?  This one is keeping us from releasing.

We also can’t release w/o this fix

Hi I have noticed also very slow the scrollview widget and opened a new topic in this forum:

http://forums.coronalabs.com/topic/34680-scrollview-with-images-load-very-slow/

I do not know if it has anything to do or be for the same reason.

Thanks for the reply.  Don’t think that is the issue as this is occurring on all storyboard scenes with or without a scrollview.

I suspect that that log message has some meaning that i don’t get.  Like i said … only see that log message on the android.

Wondering why the path on that is "/data/data … " … seems odd. 

I suspect that your device is almost out of space in internal storage.  Try clearing some space and then re-run your app.  That should give rid of that error message that you see in the log.

That said, we’ll likely be getting rid of that “plugins.dex” file in the near future.  After beta testing our optional plugin support on Android, we’ve decided to change the design on how plugins are dynamically loaded at run time, which will get rid of that dex file completely.

Now, the above will only cause performance issues on startup.  If your app always exhibits slow performance, then the above issue is unrelated.  In which case, I suggest that you try running our sample app “Interface/WidgetDemo” that is included with the Corona SDK on your Android device and see how well it performs.  I suspect this is not a widget issue because that sample app performs well on my low-end Android devices.

The more likely case is that too much text is getting rendered.  Text rendering is *very* expensive on Android because it involves drawing the text to a bitmap and then pushing that bitmap to OpenGL as a texture.  If text is getting updated on every render pass, then that would definitely kill performance.

well i cannot imagine that it is the text … code has not changed … Only thing that changed was the corona build i was using

sure you cannot think of anything else that might be at issue.

What i have is a simple scene with a couple of buttons … i press a button and i get a long delay (3-4 seconds) before the button executes. While that delay is happening i see those related log messages i mentioned … lots of them.

Are you saying the screen transition was not slow with an older build?

If so, can you tell me which daily build number please?

Also, are you requiring anything in when you load a storyboard scene?
If so, then that would trigger the slow down.  You only need to require a library in once.

Not sure i am following you on the: “Also, are you requiring anything in when you load a storyboard scene”

Seems to happen on all of my scenes and ONLY on android.  IOS performs fine.  Cannot be a memory issue the issue occurs immediately and before i am doing anything but loading a few buttons.

here are the requires at the top of one of my scenes that is not happy:

local storyboard = require( "storyboard" ) local scene = storyboard.newScene() local widget = require("widget") local utilsArcherz = require("utilsArcherz") local XDisplayToastInfo = require("XDisplayToastInfo")

is “/data/data” really the path?

/data/data/com.missingmarble.archerzupshot/cache/.system/resources/plugins.dex

Why would i get these failures on android and not on ios device or simulator?

loading the page in question i receive:

V/Corona (16077): \> Class.forName: widgetLibrary.widget\_tableview.LuaLoader V/Corona (16077): Loading plugins: widgetLibrary.widget\_tableview.LuaLoader V/Corona (16077): Failed to write file: /data/data/com.missingmarble.archerzupshot/cache/.system/resources/plugins.dex for library widgetLibrary.widget\_tableview. V/Corona (16077): \> Class.forName: widgetLibrary.widget\_button.LuaLoader V/Corona (16077): Loading plugins: widgetLibrary.widget\_button.LuaLoader V/Corona (16077): Failed to write file: /data/data/com.missingmarble.archerzupshot/cache/.system/resources/plugins.dex for library widgetLibrary.widget\_button. V/Corona (16077): \> Class.forName: widgetLibrary.widget\_button.LuaLoader V/Corona (16077): Loading plugins: widgetLibrary.widget\_button.LuaLoader V/Corona (16077): Failed to write file: /data/data/com.missingmarble.archerzupshot/cache/.system/resources/plugins.dex for library widgetLibrary.widget\_button. V/Corona (16077): \> Class.forName: widgetLibrary.widget\_button.LuaLoader V/Corona (16077): Loading plugins: widgetLibrary.widget\_button.LuaLoader V/Corona (16077): Failed to write file: /data/data/com.missingmarble.archerzupshot/cache/.system/resources/plugins.dex for library widgetLibrary.widget\_button. V/Corona (16077): \> Class.forName: widgetLibrary.widget.LuaLoader V/Corona (16077): Loading plugins: widgetLibrary.widget.LuaLoader V/Corona (16077): Failed to write file: /data/data/com.missingmarble.archerzupshot/cache/.system/resources/plugins.dex for library widgetLibrary.widget. V/Corona (16077): \> Class.forName: widgetLibrary.widget\_button.LuaLoader V/Corona (16077): Loading plugins: widgetLibrary.widget\_button.LuaLoader V/Corona (16077): Failed to write file: /data/data/com.missingmarble.archerzupshot/cache/.system/resources/plugins.dex for library widgetLibrary.widget\_button. V/Corona (16077): \> Class.forName: widgetLibrary.widget\_button.LuaLoader V/Corona (16077): Loading plugins: widgetLibrary.widget\_button.LuaLoader V/Corona (16077): Failed to write file: /data/data/com.missingmarble.archerzupshot/cache/.system/resources/plugins.dex for library widgetLibrary.widget\_button. V/Corona (16077): \> Class.forName: widgetLibrary.widget\_button.LuaLoader V/Corona (16077): Loading plugins: widgetLibrary.widget\_button.LuaLoader V/Corona (16077): Failed to write file: /data/data/com.missingmarble.archerzupshot/cache/.system/resources/plugins.dex for library widgetLibrary.widget\_button.

This is a real issue for us.

Thanks for giving me your thoughts on this one.

One more detail … exact same code running on build 1080 DOES NOT exhibit this issue.

Snappy on android … i suspect someone introduced some badness.

This continues to stop our app release … please resolve this issue.  Android deployment is dead in the water till this is fixed.  Going back is not an option due to the bug fixes for Widget 2.0 and rolling back prior to Widget 2.0 is really out.  

Perhaps we jumped into the water too early.  Could really use a fix for this issue!

Please!

Thanks

An ETA would be much appreciated.  Is it a few days, a few weeks, or months?  It would be nice to know if I should begin working on rolling my code back to use the last public release and undoing all the Widget 2.0 changes.

Thanks.

We’ll have this issue resolved by the end of this week.

If you can’t wait, then your options are:

  1. Revert back to the last release version, build #1076.

  2. Use the widget Lua files we have on BitBucket instead.

   https://bitbucket.org/coronalabs/framework-widget

The reason option #2 above works around this problem is because our current widget code is attempting to require() in widget Lua files.  By adding those Lua files to your project, the require() will always succeed and prevent the performance issue.  The reason it is slow now is because the require() fails to find these files and falls-back to our core implementation.  When we fix this issue, we’ll have to modify our widget library to support both ways for those who still want to fork their own version of widgets, but without the performance issue.

Thanks Joshua.  That’s exactly what I needed to know.

The slow down occurs due to your require statements because it involves accessing the file system.  Try changing your code so that you only require libraries once instead of every time you load a scene.  That will work-around this issue.

The slow-down issue is currently caused by our plugin system which is currently in beta.  We’ll be modifying the behavior in the near future to eliminate the slow-down.  But in the meantime, the above work-around will solve this issue… and improve performance a bit on iOS too since it will avoid file system access.

Glad to know that i am not going crazy …

So are you suggesting that i make those globals? 

Loading them in the main?

I thought that the recommended way to do things was with local variables and not with Globals.

Can you help me understand what you are specifically suggesting with your work-around suggestion.

Thanks,

m