android - lockCanvas() really slow -


testing game on slower device (orange san francisco aka zte blade) , have been getting appalling frame rate.

i put debug code draw loop , discovered following line taking on 100ms:

c = msurfaceholder.lockcanvas(); 

anyone else seen behaviour? temporarily replaced surfaceview extending view , implementing ondraw(), , got much better framerate.

although in general surfaceview faster on htc desire. suspicious may android 2.1 problem. i'm contemplating rooting phone , upgrading 2.2 if possible, did want device running on 2.1 might counter-productive in long run.

** update **

i've been working on more, , have discovered more puzzling aspects it.

i rooted phone , installed 2.2 , problem still happens. when app first started, lockcanvas working expected (0-1 ms). @ point during initialisation, lockcanvas starts taking approx 100ms.

it might worth pointing out loading assets in async task, can display loading screen.

despite best efforts pin down program doing when slowness occurrs not able so. in fact when run in debug mode , single step, works fast!

now discovered if add delay in constructor of surfaceview (of 10 seconds), slowness doesn't occur , works fine.

however if press home, , switch back, slowness comes back.

i'm pretty @ end of tether on stupid illogical problem! i've got mind put down device specific problem.

i feel have memory usage. maybe being swapped out , affects video ram?

i'd interested in theories @ least.

about lockcanvas() docs:

if call repeatedly when surface not ready (before callback.surfacecreated or after callback.surfacedestroyed), calls throttled slow rate in order avoid consuming cpu.

is possible draw loop initiated devices? think problem, since wrote:

now discovered if add delay in constructor of surfaceview (of 10 seconds), slowness doesn't occur , works fine.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -