Skip to content
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

Merged
merged 1 commit into from May 6, 2014
Merged

Conversation

ntherning
Copy link
Contributor

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 or UITouch 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 single UIAcceleration 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.

…ngle UIAcceleration instead of creating new ones on each touch/acceleration event.
@ntherning
Copy link
Contributor Author

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.

@jrenner
Copy link
Member

jrenner commented Apr 24, 2014

People tend to run off lbgdx nightlies a lot so maybe waiting for next
official robovm release would be smart

@badlogic
Copy link
Member

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!

@johnnyapol
Copy link
Member

This will also fix #988 as well. Thank you!

@ntherning
Copy link
Contributor Author

Looks like the RoboVM build server was stuck. No nightly had been built
since I made the latest changes which is required by this patch. I have now
restarted the build server. You should see a new build within an hour or so
on http://download.robovm.org and new snapshots in Maven Central. Sorry
about that.

On Sat, Apr 26, 2014 at 11:01 AM, Alex Vega notifications@github.comwrote:

I have error with this pull (merged manually):

Parameter 2 of @bridge annotated method
<com.badlogic.gdx.backends.iosrobovm.IOSInput$NSArrayExtensions: long
$m$objectAtIndex$(long,org.robovm.objc.Selector,long)> must be of type long
when annotated with @pointer.

Latest all.


Reply to this email directly or view it on GitHubhttps://github.com//pull/1758#issuecomment-41463799
.

@semtiko
Copy link
Contributor

semtiko commented Apr 26, 2014

@ntherning thanks! Sorry, i removed my previous comment because i spot old nightlies.
For another readers - i just reported about error while compiling project, but found a reason.

@BlueRiverInteractive
Copy link
Contributor

@badlogic I think this could be merged now (RoboVM 0.0.12 is out)?

@semtiko
Copy link
Contributor

semtiko commented May 6, 2014

It's time )

@badlogic
Copy link
Member

badlogic commented May 6, 2014

Am 06.05.2014 17:02, schrieb Alex Vega:

It's time )


Reply to this email directly or view it on GitHub
#1758 (comment).

It's time when i say it's time. Which is when RoboVM 0.12 is released :)

@alexander-mironov
Copy link
Contributor

Then you should say it! http://blog.robovm.org/2014/05/robovm-0012-released.html

@badlogic
Copy link
Member

badlogic commented May 6, 2014

Ah, didn't have time to check the intratubes yet today. Thanks for the
headsup, will see what i can do :)

Am 06.05.2014 17:41, schrieb alexander-mironov:

Then you should say it!
http://blog.robovm.org/2014/05/robovm-0012-released.html


Reply to this email directly or view it on GitHub
#1758 (comment).

@badlogic badlogic merged commit fcb9c3d into libgdx:master May 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants