Fabric API

Fabric API

106M Downloads

EventFactory's invoker factories could pass a profiler parameter

ChloeDawn opened this issue ยท 1 comments

commented

Rather than having a static profiling check, invoker factories could pass a dedicated profiler for listener profiling, segregated from the game's other profiling to avoid concurrent modification and guard against leaks internally, and a no-op profiler can be passed when event factory profiling is disabled. Alternatively, it could pass a form of a delegator, that takes a profiler given by the modder from the context of their callback, and handles whether calls are passed onto it internally based on the event factory state.

commented

A no-op profiler still involves a significant amount of INVOKEVIRTUAL calls, which will be noticeable at the scale of often-happening events. Events are all about performance - everything else is secondary.