ruipin / fvtt-lib-wrapper

Library for Foundry VTT which provides module developers with a simple way to modify core Foundry VTT code, while reducing the likelihood of conflict with other modules.
GNU Lesser General Public License v3.0
35 stars 15 forks source link

Add high-performance wrapper type. #25

Closed ruipin closed 3 years ago

ruipin commented 3 years ago

While negligible in most cases, libWrapper will add some overhead to wrapper calls compared to traditional wrappers.

In some cases, e.g. testWall, methods get called thousands of times in a loop, meaning that said performance hit actually becomes noticeable.

For these cases, it could make sense to add a wrapper type which does static dispatch. This type would avoid having to set up the libWrapper context, and forgo most of the libWrapper safeties, keeping only basic conflict checking and module prioritisation. Everything necessary for this wrapper should be resolved at wrapping time, similar to how the shim does it.

ruipin commented 3 years ago

This is now implemented in v1.5.0.0.