New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Less GC in RoboVM iOS backend #1758
Conversation
…ngle UIAcceleration instead of creating new ones on each touch/acceleration event.
Please note that this will only work with changes just added to RoboVM. So you may want to wait for the next nightly build of RoboVM before you merge this. |
People tend to run off lbgdx nightlies a lot so maybe waiting for next |
Wow, this is a really cool solution. I'll update our snapshot to this new RoboVM version once the nightlies are live. We'll do a patch release once the next RoboVM release is out. Thanks a ton and see you in Istanbul! |
This will also fix #988 as well. Thank you! |
Looks like the RoboVM build server was stuck. No nightly had been built On Sat, Apr 26, 2014 at 11:01 AM, Alex Vega notifications@github.comwrote:
|
@ntherning thanks! Sorry, i removed my previous comment because i spot old nightlies. |
@badlogic I think this could be merged now (RoboVM 0.0.12 is out)? |
It's time ) |
Am 06.05.2014 17:02, schrieb Alex Vega:
|
Then you should say it! http://blog.robovm.org/2014/05/robovm-0012-released.html |
Ah, didn't have time to check the intratubes yet today. Thanks for the Am 06.05.2014 17:41, schrieb alexander-mironov:
|
The ObjC-Java bridge in RoboVM will create a Java peer the first time an ObjC instance crosses the ObjC<->Java boundary. This peer will be associated (using the
objc_setAssociatedObject()
in the Objective-C runtime) with the ObjC instance and the next time the same ObjC instance crosses the boundary the same peer will be used on the Java side. The Java peer will retain the ObjC instance until the Java peer is GCed.For frequently created, short-lived objects (like
UIAcceleration
orUITouch
instances) this can lead to performance problems. The Java peers quickly become unreachable but cannot be reclaimed until the next GC and the corresponding ObjC instances will not be deallocated until the Java peer is GCed.This patch uses a single
UITouch
and a singleUIAcceleration
instead of creating new ones on each touch/acceleration event. These events are handled single-threaded so reusing the same instance should not be a problem. As far as I can see this significantly decreases the garbage generated and thus the frequency of GC pauses during touch and acceleration events.