haxetink / tink_core

Core utilities
https://haxetink.github.io/tink_core
MIT License
117 stars 33 forks source link

Don't inline big function #163

Closed kevinresol closed 3 years ago

back2dos commented 3 years ago

I kinda wonder what prompted this, since CallbackList.add is used only in two places:

  1. FutureTrigger::handle: this function itself is not inlined (because it's not inlineable).
  2. SignalTrigger::listen: this function is indeed inlined and having a lot of these calls will inline quite a bit of stuff into user code.

I would therefore propose to uninline SignalTrigger::listen instead. Makes generated code look closer to the original, also generates slightly less code (trigger.listen vs trigger.list.add) and has the same amount of method calls in the end.

Or if you're using CallbackList directly and see too much code, perhaps we can unline both and only inline the add call in SignalTrigger.

kevinresol commented 3 years ago

I am facing point 2 indeed. Will modify accordingly.