iOS Question recursive slowdown

sorex

Expert
Licensed User
Longtime User
Hello,

I wrote a small routine in B4J based on recursive calls. This needs 1ms to 80ms in the most worst case.

Porting it to B4A had similar to slightly slower results.

When I use the same routine on IOS the not so worse situations appear immediatly.

From a certain depth it suddenly becomes dead slow.
And with dead slow I mean hanging for minutes instead of a second or 2.

I tried in debug (with cleanup) and as release like build with debug provisioning profile.

Has anyone experienced such behaviour before?

Is it because the main thread is going in an near unresponsive loop that it slows everything down?

Is there threading that can be used to prevent this?
 

sorex

Expert
Licensed User
Longtime User
how can I test it in full release mode without publishing it?

I use this 'releaseTest' custom build method you posted once and include the development certificate and mobile provisioning.
then I use build server>build release app

I'll see if I can seperate the routine in a new project.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
I sent you an example source by PM.

Thanks in advance if you find some moment to have a look at it.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
I just added a counter into the recursive sub and it seems that if it goes through all data without successfull exiting that this is 440192 calls.

It seems that the IOS stack doesn't like this :)

I'll generate some data sets instead.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
I did. the result is the same with the big difference that everything GUI wise keeps running instead of freezing.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
I just installed the B4i bridge on my iPhone5 (which I never use for some unknown reason).

According to some sites it's about double the speed of the 4s. (not my MHz number but the combination of different processor and speed)

So a good device to benchmark that nasty routine and hopefully reduces the delays a bit or to 0.

To my surprise the routine went from 14 second to 19 seconds!

It's even slower than it was on my 4s. and about 20 times slower than on my low end Samsung Ace.

Could this be a bad pre-compile from B4i > objC that causes some overhead somewhere that's not noticable on single/a_few sub call runs?


What also is strange (on both) is that I calculate elapsed time and when it gives for example 14 seconds this label update only happends a lot of seconds later. it's like it needs to flush some stuff before it can update the GUI. (this is running in a thread)
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
ok, this is a tough one. when I isolate the relevant code into a new project it works as expected.

gui thread or new thread is the same speed (4 seconds) with freeze as only difference.


Edit:

for some reason it's now working faster as before and that label update delay is gone aswell. I'll give it another try on the 4s in the morning.
 
Last edited:
Upvote 0
Top