Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Scripts are very slow #241

Open
fineless71 opened this issue Jan 28, 2024 · 2 comments
Open

[BUG] Scripts are very slow #241

fineless71 opened this issue Jan 28, 2024 · 2 comments

Comments

@fineless71
Copy link

fineless71 commented Jan 28, 2024

LiquidBounce Branch

Nextgen

LiquidBounce Build/Version

4a5efac

Operating System

Linux

Minecraft Version

1.20.4

Describe the bug

Accessing some Java stuff from scripts (most notably player) kills my FPS, and is unbearably slow. I see a log about Execution only in interpreted mode will strongly impact the guest application performance. from GraalVM (but the page it tells me to go to shows "Page not found", of course not LB's fault). Not everything seems to have this issue, some things like client.displayChatMessage is fine.

Steps to reproduce

Try this simple script, it brings me from 60 fps to 1-2 when moving around:

module.on("playerTick", () => {
	if (!mc.player.onGround && mc.player.velocity.y < 0)
		mc.player.velocity.y = 0;
});

Client Log

[engine] WARNING: The polyglot context is using an implementation that does not support runtime compilation.
The guest application code will therefore be executed in interpreted mode only.
Execution only in interpreted mode will strongly impact the guest application performance.
For more information on using GraalVM see https://www.graalvm.org/java/quickstart/.
To disable this warning the '--engine.WarnInterpreterOnly=false' option or use the '-Dpolyglot.engine.WarnInterpreterOnly=false' system property.

Screenshots

No response

@1zun4
Copy link
Member

1zun4 commented Jan 28, 2024

I think the only thing we can do is to use GraalVM in the LiquidLauncher.

@1zun4 1zun4 transferred this issue from CCBlueX/LiquidBounce Jan 28, 2024
@fineless71
Copy link
Author

fineless71 commented Jan 28, 2024

I hope this can be fixed another way. The following performs fine for example:

module.on("playerTick", () => {
	client.displayChatMessage("Speed: " + movementUtil.speed());
	client.displayChatMessage("Speed: " + movementUtil.speed());
	client.displayChatMessage("Speed: " + movementUtil.speed());
});

What I originally thought was going on is that when mc.player is used, it first needs to convert the entire mc object to js, which is huge and probably takes a while (and maybe even everything it holds), and then player as well. But onGround seems to perform ok-ish, while velocity is very bad. So I have no idea. But I feel even in interpreted mode it still shouldn't bring me to 1 fps..

Although I agree that LiquidLauncher should use GraalVM as it could only help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants