BlueCyro / CherryPick

Simple component searching for Resonite
MIT License
20 stars 8 forks source link

Custom Generic Arguments field causes performance degradation #17

Open brecert opened 6 months ago

brecert commented 6 months ago

CherryPick's generic arguments field lags significantly compared to without the mod.

I think CherryPick may be checking if the type is valid every frame as more complex types cause more lag and every node browser with types in the generic arguments field affect it.

An easy way to reproduce this is to use IValue<IValue<IValue<IValue<IValue<IValue<IValue<IValue<IValue<IValue<IValue>>>>>>>>>> as the generic custom arguments for WriteDynamicObjectVariable.

On my system it degrades the engine update time to ~30fps, compared to without the mod where it's ~275fps.

BlueCyro commented 6 months ago

Please provide logs, make sure your RML is up to date and make sure CherryPick is up to date.

BlueCyro commented 6 months ago

Just as an FYI, I was able to replicate this, but please do remember to include those in the future. This appears to be another case of voodoo magic that I've run into, and is potentially related to #10.

The running theory I have is that reflecting all of the types in the game causes a cache buildup somewhere, and that cache is hit whenever certain parts of reflection are used. This is going to prove hard to diagnose, so don't expect an immediate fix.

BlueCyro commented 4 months ago

I changed up how CherryPick populates its component cache, and this should be far less of an issue now. Give release 1.1.0 a shot and tell me how it goes! If all is well, I'll close up this issue.