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 (LiquidBounce is currently incompatible with Lithium)
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.