Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

WP8 performance problem
Started by deniz Jan 26 2015 07:06 AM

18 replies to this topic
performance windows phone 8
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

deniz

[GLOBAL: userInfoPane.html]
deniz
  • Contributor

  • 152 posts
  • Corona SDK

Hi,

 

I am trying to port my existing apps to wp8 but suffer from bad rendering performance (frame rate drops to ~10fps and my games are barely playable).

 

I decided to make a small sample using only a basic scrollView widget populated like a list with 20 rows. I do not use any text objects but only small icon graphics and button widgets. When I tested this on a nokia lumia 920 scrolling is not fluid. 

 

Am I missing something or Corona wp8 performance is that bad?

Could you fellow corona developers run this sample on your own devices and tell me what is going on?

 

wp8 sample project:
https://www.dropbox.com/s/xs9c4xx615w8664/ListSample.zip?dl=0

 

thanks.

 



[TOPIC: post.html]
#2

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

I just tested your project on my low-end Lumia 620 device... and the performance and framerate is good.  Definitely 60 FPS.

 

Note that you are *not* going to get 60 FPS if you run your app via the Visual Studio debugger.  That is, the debugger will severely hinder the framerate.  To see what the actual framerate will be, build/deploy a "Release|ARM" version of your app, *stop* the debugger, and then run your app normally on your device.



[TOPIC: post.html]
#3

deniz

[GLOBAL: userInfoPane.html]
deniz
  • Contributor

  • 152 posts
  • Corona SDK

Joshua, I am doing exactly what you recommend: build it Release+ARM, deploy it to the test device, stop running instance and restart it from device again. Scrolling is not fluid/smooth, definitely not 60fps. By the way; my test device is lumia 925 which is way better than a 620 as far as i know.

 

I am sure that i am missing something, but what. Any ideas?



[TOPIC: post.html]
#4

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

I'm not really sure then.

 

Have you tried downloading other Corona made WP8 apps on your device to see how well they perform?  Particularly...

   http://www.windowsphone.com/en-us/store/app/feed-omnomster-the-hungry-monster/05696854-39a9-464b-887c-35dce28a6148

   http://www.windowsphone.com/en-us/store/app/bloody-monsters/5c3c1f4b-eaa7-4767-a58c-9ce9e2c496c8



[TOPIC: post.html]
#5

deniz

[GLOBAL: userInfoPane.html]
deniz
  • Contributor

  • 152 posts
  • Corona SDK

Yes, both of them working smooth. :/



[TOPIC: post.html]
#6

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

Did you modify your "MainPage.xaml.cs" file?

 

When you create your CoronaCards project in Visual Studio, the MainPage class' constructor should look like this...

public MainPage()
{
    // Initialize this page's components that were set up via the UI designer.
    InitializeComponent();

    // Set up Corona to automatically start up when the control's Loaded event has been raised.
    // Note: By default, Corona will run the "main.lua" file in the "Assets\Corona" directory.
    //       You can change the defaults via the CoronaPanel's AutoLaunchSettings property.
    fCoronaPanel.AutoLaunchEnabled = true;

    // Set up the CoronaPanel control to render fullscreen via the DrawingSurfaceBackgroundGrid control.
    // This significantly improves the frame rate and is the only means of achieving 60 FPS.
    fCoronaPanel.BackgroundRenderingEnabled = true;
    fDrawingSurfaceBackgroundGrid.SetBackgroundContentProvider(fCoronaPanel.BackgroundContentProvider);
    fDrawingSurfaceBackgroundGrid.SetBackgroundManipulationHandler(fCoronaPanel.BackgroundManipulationHandler);
}

Notice the code block at the bottom that sets up Corona to render to a "DrawingSurfaceBackgroundGrid" control.  This is required in order to do 60 FPS rendering in a Microsoft WP8 Silverlight app.



[TOPIC: post.html]
#7

deniz

[GLOBAL: userInfoPane.html]
deniz
  • Contributor

  • 152 posts
  • Corona SDK

No we did not modify any of the template project files. By the way, I just checked "feed omnomster" game again and experienced sudden fps drops after playing 30 seconds.



[TOPIC: post.html]
#8

Rob...

[GLOBAL: userInfoPane.html]
Rob...
  • Contributor

  • 329 posts
  • Corona SDK

I have a 925 and Can confirm it its very smooth. I used latest Corona Cards and I have latest 8,1 update on phone just so you know.

Have you tried turning it off and on again? :)



[TOPIC: post.html]
#9

Rob...

[GLOBAL: userInfoPane.html]
Rob...
  • Contributor

  • 329 posts
  • Corona SDK

I dont mind email you my xap file so you could see if that works on your phone. Might help to see if its the build process going wrong. I camt attach it as its over the 1.25 MB limit by 2MB



[TOPIC: post.html]
#10

deniz

[GLOBAL: userInfoPane.html]
deniz
  • Contributor

  • 152 posts
  • Corona SDK

Rob; my gmail address is deniz.aydinoglu

thanks.



[TOPIC: post.html]
#11

Rob...

[GLOBAL: userInfoPane.html]
Rob...
  • Contributor

  • 329 posts
  • Corona SDK

Done. Im guessing you copy and overwite this into your bin/release and then go to deploy from vis studio



[TOPIC: post.html]
#12

deniz

[GLOBAL: userInfoPane.html]
deniz
  • Contributor

  • 152 posts
  • Corona SDK

Ok. I installed rob's xap to my device using deployment application. Its running at exactly the same speed as my own deployment. I captured a video to show you what is going on. (yeah, i am that desperate)

 

As you may see by carefully looking, movement is not very smooth. If I am going add some background image or more items it would be worse. If I run this on an iphone 4s or a galaxy s3 its nice and fluid.

 

Here is my capture: https://www.dropbox.com/s/a9v7j2qj2bol4dr/Video%2029.01.2015%2013%2056%2022.mov?dl=0



[TOPIC: post.html]
#13

Rob...

[GLOBAL: userInfoPane.html]
Rob...
  • Contributor

  • 329 posts
  • Corona SDK

Maybe its just me but Its hard to see anything not smooth in that video. The video is probably recording at 30fps anyway. Have you got latest windows 8.1 on the phone?



[TOPIC: post.html]
#14

deniz

[GLOBAL: userInfoPane.html]
deniz
  • Contributor

  • 152 posts
  • Corona SDK

yeah you are right, its hard to see that on a video. it just feels not smooth. anyways: i am going to arrange a more complicated sample (with more objects).

 

and yes, i got windows 8.1 (freshly updated today) and yes, i restarted it several times (good old windows habits :)



[TOPIC: post.html]
#15

Rob...

[GLOBAL: userInfoPane.html]
Rob...
  • Contributor

  • 329 posts
  • Corona SDK

I guess the only other thing you can do is test on a different Windows Phone



[TOPIC: post.html]
#16

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

This definitely does not sound normal.  After a few Google searches, I've found some forum threads where people ran into a general slowness issue on WP8.  Have a look here to see if any of this applies to you...

   http://forums.windowscentral.com/windows-phone-8-1-preview-developers/275706-windows-phone-8-1-slow-some.html

 

First, I would double check if you have several apps running in the background (aka: "background tasks) that maybe slowing down your device.  Try disabling them to see if it improves anything.

 

Also, I've heard if the "battery saver" is always on, indicated by a heart icon over your battery meter in the status bar, then that may put your CPU in low power mode and slow it down.  I've tried that for myself and haven't experienced any problems, but perhaps that in combination with some backgrounded app/tasks might cause some slowness.

 

I've also heard that if you're a heavy user of Microsoft's OneDrive feature, then your WP8 device might be busy syncing files in the background too.  So, that might be a possible cause.

 

Other than that, I'm not sure what the issue could be.

But I definitely want to help you isolate it for my own knowledge.  So, I'm not giving up on you.



[TOPIC: post.html]
#17

deniz

[GLOBAL: userInfoPane.html]
deniz
  • Contributor

  • 152 posts
  • Corona SDK

Joshua, i followed your advices and double check everything you said. Nothing changed.

 

I build a very similar test application using Cocos2d-x:

https://www.dropbox.com/s/q0svush7pzrp3e2/CocosSample_Release_ARM.xap?dl=0

 

And here is my Corona version:

https://www.dropbox.com/s/wgw2nf05568k849/ListSample_Release_ARM.xap?dl=0

 

Could you please deploy both of those to your devices and compare their performance? I get 58-60 fps on cocos2dx. Corona version feels* very "laggy"



[TOPIC: post.html]
#18

Rob...

[GLOBAL: userInfoPane.html]
Rob...
  • Contributor

  • 329 posts
  • Corona SDK

Just wondering when you deploy while connect. What is the fps on the debug overlay?



[TOPIC: post.html]
#19

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

I've noticed that you are using build #2468.  We've made some performance improvements since then.  In this case, I've noticed that you are using widget.newButton() in each row, which uses display.newText() internally even if you do *not* display text within the button (it'll create an empty "" text object in that case).  We've optimized Corona for WP8 since then to no incur a performance penalty for text objects that contain no characters or unprintable characters.

 

So... I recommend that you grab the newest daily build and re-build/re-test your app.

 

That said, I would expect Cocos2d-x to render faster than Corona on WP8.  This is because they're built using different Microsoft frameworks, each having their own advantages and disadvantages.  Cocos2d-x only supports pure native DirectX WP8 apps and does *not* support native UI, ads (Google AdMob or Microsoft Ads), or .NET (C# or VB).  This means you can only develop a pure DirectX driven game via Cocos2d-x.  This also makes business style apps impossible.  Now, Corona only supports building WP8 Silverlight apps which *does* support Microsoft's native UI (including ads) and .NET support.  Now, the reason a Silverlight app will be a bit slower is because the Corona has to compete with Microsoft's native UI framework for control over the CPU (ie: the 1 Direct3D rendering thread that has to be shared).  But that said, I still find the framerate to be about 60 FPS even on the low-end devices, but admittedly, I have one Lumia 920 where the framerate is usually around 45-50 FPS and we can't squeak anymore performance out of a Silverlight app.

 

But that said, I've never heard of anyone getting 10 FPS on a WP8 device with Corona before.  This is extremely unusual.  After updating your project to the newest daily build, would you mind inserting the below code into your "main.lua" to measure the actual FPS please?  It'll log the average FPS once per second.

local lastEnterFrameTime = nil
local durationCollectionSize = display.fps
local durationCollectionIndex = 1
local durationCollection = {}
for index = 1, durationCollectionSize do
	durationCollection[index] = 0
end
local function onEnterFrame(event)
	local currentTime = system.getTimer()

	-- If this is the first frame, then fetch the current time and exit out.
	if (lastEnterFrameTime == nil) then
		lastEnterFrameTime = currentTime
		return
	end

	-- Store the duration since the last frame.
	durationCollection[durationCollectionIndex] = currentTime - lastEnterFrameTime
	lastEnterFrameTime = currentTime

	-- Do not continue if we have more durations to collection before averaging below.
	if (durationCollectionIndex < durationCollectionSize) then
		durationCollectionIndex = durationCollectionIndex + 1
		return
	end

	-- Average the collected durations and print it to the log.
	local averageDuration = 0
	for index = 1, durationCollectionSize do
		averageDuration = averageDuration + durationCollection[index]
	end
	averageDuration = averageDuration / durationCollectionSize
	local averageFps = 1000 / averageDuration
	print("Average FPS = " .. tostring(averageFps) .. ", Average Duration = " .. tostring(averageDuration))

	-- Reset data collection.
	durationCollectionIndex = 1
end
Runtime:addEventListener("enterFrame", onEnterFrame)




[topic_controls]
[/topic_controls]