Skip to content
This repository has been archived by the owner on May 26, 2018. It is now read-only.

unregister a TickHandler - TickRegistry.unregister(ITickHandler) #193

Closed
zsawyer opened this issue Mar 4, 2013 · 3 comments
Closed

unregister a TickHandler - TickRegistry.unregister(ITickHandler) #193

zsawyer opened this issue Mar 4, 2013 · 3 comments

Comments

@zsawyer
Copy link

zsawyer commented Mar 4, 2013

I know that right now one can pass "EnumSet.noneOf(TickType.class);" or "null" for the overridden tick()-method. But this does not seem like a neat solution.

To optimize performance it should be possible to cleanup a tick handler that is not needed anymore: TickRegistry.unregister(ITickHandler)

This comes into use when mods provide an interface to be disabled or deactivated at runtime.
But there might also be occasions where TickHandlers are logically bound to ingame objects. When the Object is gone the Handler should too.

Right now there will still be an artifact handler instance which will just return null on tick(). But this means unnecessary memory usage and method calls, and statement evaluations (esp. in the for-loop at FMLCommonHandler.java:114 with unnecessary calls at lines 116, 117, 118)

Thanks for considering.

@immibis
Copy link
Contributor

immibis commented Mar 10, 2013

Is there a measurable performance benefit?

@cpw
Copy link
Contributor

cpw commented Mar 10, 2013

I'm not sure what would benefit here. The cost of tick queue management has never been measurable that I have seen.

@cpw cpw closed this as completed Mar 10, 2013
@zsawyer
Copy link
Author

zsawyer commented Mar 13, 2013

As this is only an enhancement request and not a PR I have no test data.
But being able to clean up objects which eat up ram and cause extra code execution simply sounded like a good idea to me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants