Skip to content
This repository was archived by the owner on Sep 23, 2023. It is now read-only.

Conversation

@KosmX
Copy link

@KosmX KosmX commented Jul 25, 2021

see issue #13

I did modify args from colored-lights with a higher priority than bendy-lib

Copy link
Owner

@Gegy Gegy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for this PR!
Main concern here is with @ModifyArgs requiring a fair bit of allocation with boxing each value & the args object.. not sure if there's any way to avoid this though without taking a totally different approach.

@Fourmisain
Copy link

When I originally wrote it I was thinking about that too and I was gonna suggest running tests on this - then forgot about it.
There's no simple way around this overhead - there may be a way of directly changing the render method parameters, but since this method is recursive it would probably not be correct.

I did just run a quick and dirty comparison test, with the above mixin, vs an empty method mixin (not a fair comparison, but that's kinda the point). I had a lava source and sea lantern near ~50 zombies, so that should be 300 model parts.
With the empty mixin I got around 101 fps, with the above mixin I got around 99 fps, with some fluctuation of maybe ±3 fps.

Because it was so unscientific, I ran a more controlled test in a flat world with increases entity cramming, I put a ton of zombies (entity counter says 325) in a 2x2 hole and put 2 sea lanters at each side.
Got ~48 fps with above mixin, ~49 fps with an empty mixin, ±2 fps.

So the overhead might actually not be that bad.
I also don't think GC will be significantly impacted by this - G1 should do fine with it, though maybe some more testing is required on this front?

@KosmX
Copy link
Author

KosmX commented Jul 25, 2021

With the redirect, you copy variables on the stack.
Now, you do it in a function, not by a function call.

If you want to improve the render performance, you should do colored lights by shaders, not by Java code

@Fourmisain
Copy link

Just to complete the performance comparison, here's the @Redirect version vs the @ModifyArgs, only colored-lights:

@Redirect:
redirect
@ModifyArgs:
modifyargs

So all in all: There is a measurable difference, albeit pretty small (<1ms, ~1 fps on my system).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants