Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2888] [ios] event queue and postlayout event.

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionFixed
Resolution Date2012-08-06T10:43:46.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsaddeventlistener, event, postlayout
ReporterMartin Guillon
AssigneeVarun Joshi
Created2012-07-23T23:44:29.000+0000
Updated2016-03-08T07:47:51.000+0000

Description

I found a potentially big problem with the event queue. My application uses a lot of animations and a few of my views listen for 'postlayout' events (because they need to layout upon size change). as all events are queued in the same context, you especially get 'postlayout' events and buttons 'click' events in the same queue. In my case i was showing a view with something like 10 views animating (slidein, slideout), this triggered something like 2000 'postlayout' events. Then just after that if the user triggered a button, it took about 1.5 sec for that event to be processed. Why? because there was 2000 events to process first (event if the associated js callback did nothing). If i stop listening for "postlayout" events, then everything goes smoothly. I think something needs to be done about this, i dont think 'postlayout' events should, in any case, slow down the process of other events. May be we could use different event thread, or may be we could reduce the number of 'postlayout' events (dividing into 'resize', opacity, ....) What do you think? I am willing to work on this one , but i need help figuring out the best solution. Especially because i still know very very little about kroll bridge context ....

Comments

  1. Ivan Skugor 2012-07-25

  2. Martin Guillon 2012-07-26

    My problem is not with when 'postlayout' event are fired, but on which thread. But you are right, if less 'postlayout' events would be fired, it would be better. But i still think it s another problem
  3. Varun Joshi 2012-07-26

  4. Martin Guillon 2012-07-30

    It s a hundred times better, and i really mean a hundred time!. Now i never get more than 50 events in the queue, even with all my animations. So i guess it solves my issue, but isnt it just a temporary fix? I mean buttons event should have priority over other events such as postlayout events. That bug is gonna come back. For example i am working on a motion module to get gyroscope ...It can fire events at 100Hz so i am almost sure it will come back ;) But for now i am good, so i guess this one can be closed
  5. Varun Joshi 2012-08-06

    Closing this issue.

JSON Source