Codea 2.1 running code very slowly

Hi guys, I can see there’s a big hype for Codea 2.1 released in these days.
But, am I the only one here that noticed anything is now running pretty much slower?
I’m a nooby coder, but nothing I’ve written so far seems running smoothly anymore.
FPS drop very often to 30/40 now, apparently for no reason ( few objects moving on screen ).

Is this all a consequence of my bad coding or anybody else has this same issue?

Code and assets :

Assets :
Code :

Sorry for the messy code :wink:

Can you give details of your iPad and iOS version, and maybe post some code that runs slow?

Hi @Ignatz, thank you.

Sure thing : Ipad 3, Ios 7.1.2
As for the code, there’s quite some code I did not want you guys to waste your time on, especially when it used to run fine until yesterday.

EDIT : shall I update to IOS 8.1.1 ?

@deactive it’s going to depend on a number of things, is it a big project? Are you able to isolate the thing that is slow?

@Simeon, thank you very much for your interest.
It happens even when there’s a minor bunch of objects moving on the screen.
However I’ve tried the old Mesh sample and it runs just fine and smoothly.
I suspect my bad code is somehow responsible, but why did it run fine with previous Codea versions?

I’ll try either way to put everyting on some repo, including assets, to check what’s wrong with the help of CC.

@deactive it could be the case that something in Codea changed to make a specific part of your code run more slowly. We’ll have to experiment and see.

thanks @simeon, I’ll shortly post the code and the assets.

updated thread description with source code and images.
thank you

  • EDIT : shall I update to IOS 8.1.1 ?

The worst thing I’ve done to my iPad 2 was updating it from iOS 7.x to 8.x. The second worst thing: updating it from iOS 6.x to 7.x. Since then I’m exercising my patience on every action and every app. I cannot tell if it would do the same to your iPad, but I’d suggest reading several reviews from people with similar devices (iPad 3 in your case)

Hi @LightDye, I’m actually comfortable with IOS7. I thought Codea 2.1 could have implemented optimized routines for IOS8 and that’s why I was considering IOS upgrade.

I only upgraded to iOS 7 to get Codea 2.0 - I was perfectly happy with 6.2, however I wished I hadn’t upgraded my iPad 3 to 8.1 as it’s really made it chug.

The cynic in me believes it’s because Apple want me to upgrade to an Air 2 just to keep the same level of responsiveness, because I can’t think of any good reason why iOS 8 should run slower than 7 (other than crap coding!)

each update I went thru in the past, since Ipod touch running os 3 ( even before it was named IOS, with iphone 4 I think ), made each device running slower. Patience is something I, too, have learnt with the time. However I don’t believe this is the reason my game stutters since last Codea update.

I hope some good chap here can give me a helping hand, or it means I’ve wasted lots of hours :frowning:

@deactive - have you done any profiling of your code, maybe running certain functions in a loop several times or blocking out sections of code and using the clock functions to actually time them.

If possible you could run the code under the following scenarios.

iOS 7 - running Codea 2.0
iOS 7 - running Codea 2.1
iOS 8.1.1 - running Codea 2.0
iOS 8.1.1 - running Codea 2.1

That will give you and @Simeon a better understanding of what’s changed and also where the actual bottlenecks are. I haven’t looked at your code yet so I couldn’t say, but there might be some algorithmic changes that you could make that would have an impact on the frame rate.

hi @TechDojo, haven’t done any so far as I updated codea just last night.
I just commented on some parts but couldn’t spot the actual issue yet.

One question: how can you test your code with different Codea and IOS versions? With regards to IOS versions, I have no Apple dev account yet so I can’t rely on xcode emulator.

You ask some friendly forumites nicely if they’d be willing to test your profiled code and report back the findings. I’m sure there are plenty of people who fall into the four categories who’d be willing to help.

Asking to take a peek at the code to see if somebody can see something wrong is one thing. But asking to download the entire piece of code and run it to spot the issue in place of me, is quite too much and unpolite I think. I just had not to update Codea like a headless chicken last night whilst still learning how to code properly in the first place.

I currently reviewing the code, but I already got rid of local vars or print statements inside loops. I already also use meshes, so I can’t really find the line that makes my items stuttering. Apprently everything I draw, contributes to a general speed reduction.

@deactive - I have an iPad3 running iOS 8.1.1

Your program runs at over 60 FPS (by your measure), and doesn’t slow down, at least for the minute or so I ran it - several times over.

I would try turning your iPad right off and restarting it.

If you still have problems, I would report them on a new thread, let’s take it out of this thread, to avoid cluttering it.

Hi @ignatz, I already tried to restart Ipad, but it did not help.
I took the code out my original project and put into a brand new but had no luck as well.
When I run the game it constantly keeps going between 63/64 and 30/35 fps.
It is really weird, I’ll try to reinstall codea to see if it solves the problem.

@Ignatz - agreed, @deactive however whilst I will concede that updating Codea has had an impact on your code, sooner or later you would have had to update it, better to find out sooner, rather than later.

I suspect that moving over to the new threaded rendering model will almost certainly change what is considered “best practice” for getting optimum performance out of Codea but whatever that is - the new style of Codea is here to stay (as is iOS8) so we might as well bite the bullet.

@techDojo, you’re right, and I’m encouraged that on @Ignatz’s Ipad with IOS8 code runs fine. If reinstalling Codea doesn’t help, I’ll go for IOS major update. Hope I won’t regret :-/