Fabric API

Fabric API

108M Downloads

Improve BlockApiLookup performance

Technici4n opened this issue ยท 3 comments

commented

Unfortunately, the nested lambdas for block API lookups seem quite slow. Maybe we should look into fixing that instead? A simple registerForBlockEntity((be, direction) -> be.field, BE_TYPE) goes through 3 or 4 levels of lambdas right now.

Another option would be to allow some block api providers to opt into strong caching of a returned API, meaning that the instance can be cached until the provider somehow invalidates it. This would have a goal similar to Forge's LazyOptional, except that it would be handled transparently by BlockApiCache. But I would rather optimize the query than introduce this can of worms. ๐Ÿ˜„

commented

The problem:
image

commented

After some profiling, it seems that we can reach 30M API queries/s with BlockApiCache, which should clearly be fast enough for the time being. But some improvements might be possible, tbd.

commented

Going to close for now.