A Simple Benchmark Performance Test for LiquidBounce's ScriptAPI
-
Author: mumy
Introduction
Since LiquidBounce switched its ScriptAPI language to JavaScript from version b57, it has provided powerful extensibility. However, the community has not conducted a specific performance evaluation on it. Recently, I realized this gap and decided to perform a simple benchmark to assess its performance.
Test
I plan to divide the scripts into two categories: Standard Scripts and Hybrid Scripts (e.g.,
mumyPacketDebugger
). The tests will include Fibonacci numbers, the Sieve of Eratosthenes, and block scanning in the world. For the Nextgen version, tests will be conducted using ZuluJDK and GraalVM.The final result will be based on the shortest time taken after the runtime stabilizes.
Script
Benchmark for legacy b99 and nextgen 0.24.zip
Platform
- OS: Windows 10 22H2
- CPU: Intel i9-14900HX (locked at 5.0GHz)
- RAM: DDR5 16GB + 16GB 5600MHz
Environment
- Legacy
- Version: b99
- JDK: ZuluJDK 8
- Minecraft: Forge 1.8.9 + OptiFine M5
- Nextgen
- Version: 0.24
- JDK: ZuluJDK 21 / GraalVM 21
- Minecraft: Fabric 1.21.4 + Sodium 0.6.6
Results
Legacy
Test Case Fibonacci Sieve of Eratosthenes World Scanner Standard Script 149ms 61482ms 1539ms Hybrid Script 59ms 1147ms 311ms Nextgen
Test Case Fibonacci Sieve of Eratosthenes World Scanner Standard Script + ZuluJDK 9890ms 9629ms 9368ms Standard Script + GraalVM 144ms 1277ms 1952ms Hybrid Script + ZuluJDK 67ms 1023ms 195ms Hybrid Script + GraalVM 52ms 982ms 177ms Conclusion
There are some special versions of LiquidBounce that I haven't tested, but most of them are outdated and have limited reference value (e.g., Legacy-b73 1.12.2 or Nextgen 0.17, which didn't yet support GraalJS JIT).
For the Legacy version, since Nashorn has been used as the Script engine since b57, theoretically, there are no significant performance differences across versions.
For Nextgen, if you don't use GraalVM to launch LiquidBounce, you may experience lag when running standard scripts. I recommend using LiquidLauncher to solve this issue.
-
Looks quite unexpected to me that for Fibonacci the performance is worse for the graaljs compared to nashorn. Also from my side, using
//@ts-ignore blocks.push(mc.theWorld.func_180495_p(blockPos.func_181079_c(x, y, z)));
vs
//@ts-ignore blocks.push(mc.world.getBlockState(blockPos.set(x, y, z)));
does not look the same to me because the later involves remapping (which may lower it's performance). I am quite curious why in the script for Legacy b99 you used the srg names instead of mcp names, is the remapping for Legacy broken now? (haven't launched Legacy version for a long time myself)
-
@commandblock2 (by-mumy)
Yes, the remapper for Legacy b99 is broken, but it only affects the function name mapping, while the field names remain unaffected. This issue has led to the use of srg function names instead of mcp function names in the Legacy scripts. -
@CookieChinese only b99? if so then could u maybe test the b99 build commit before b8ff415
-
@EclipsesDev (by-mumy)
I tested using the b98 release, and its remapper is working properly, allowing the use of MCP names.//@ts-ignore blocks.push(mc.theWorld.getBlockState(blockPos.set(x, y, z)));
And the results:
Test Case Fibonacci Sieve of Eratosthenes World Scanner Standard Script 152ms 60056ms 1482ms Due to the theoretically small performance difference in hybrid scripts, testing is no longer conducted.
-
@CookieChinese should be fixed in latest nightly build https://github.com/CCBlueX/LiquidBounce/pull/5406 pls try again
-
@EclipsesDev (by mumy)
The test results show a performance difference of less than 1% compared to b98, and the remapper is working correctly.
(legacy b100 git-99f4b13) -
alright good to know
-
Dev environment
[02:09:47] [Render thread/INFO] (Minecraft) [System] [CHAT] LiquidBounce ▸ Fibonacci [time: 23306ms, value: 39088169] [02:09:47] [Render thread/INFO] (Minecraft) [System] [CHAT] LiquidBounce ▸ SieveEratosphen [time: 46371ms, value: 49999991] [02:09:47] [Render thread/INFO] (Minecraft) [System] [CHAT] LiquidBounce ▸ WorldScanner [time: 28334ms, value: 10302255]
Production environment
[02:41:41] [Render thread/INFO]: [System] [CHAT] LiquidBounce ▸ Fibonacci [time: 1571867ms, value: 39088169] [02:41:41] [Render thread/INFO]: [System] [CHAT] LiquidBounce ▸ SieveEratosphen [time: 46668ms, value: 49999991] [02:41:41] [Render thread/INFO]: [System] [CHAT] LiquidBounce ▸ WorldScanner [time: 28094ms, value: 10302255]
Both using i7-9750H, 32G DDR4 RAM with OpenJDK on Linux with Nextgen. Standard script only.
Fibonacci in development environment is significantly faster than production environment. (23s vs 1571s)