Skip to main content

Performance of PuerTS

From our test results, in the extreme case, that is, xLua (Lua53) uses wrapper, PuerTS (v8_9.4) uses xIl2cpp binding and generates wrapper at the same time:

  • Cross-language performance:
    • On Android, Puer's interop performance is about twice that of xlua
    • On iOS Puer is on par with xlua (slightly slower when there are no parameters or parameters are primitive types, slightly faster when parameters are objects).
  • Self-execution performance
    • Since lua53 does not support JIT, PuerTS is faster than xLua in execution on Android. PuerTS is even not much worse than C#.
    • On ios both language does not support JIT, PuerTS and xLua are on same level.

The benchmark project used in the test was modified by the community contributor throw-out, and can be found in this fork.

Data display

  • Puer S represents the data when not using xIl2cpp mode and with StaticWrapper generated.
  • Puer X R represents the data when using xIl2cpp mode but without xIl2cpp StaticWrapper generated (by Reflection).
  • Puer X S represents the data when using xIl2cpp mode and with xIl2cpp StaticWrapper generated.
  • Time unit is ms

Due to environmental factors, there may be slight errors in the following data.

When paying attention to interop performance, especially for struct cases, consider subtracting the time consumption of C# (i.e. API itself consumption).

android (Vivo Neo6SE)

MethodStaticCallcsharpxLuapuer Spuer X Rpuer X S
void Payload();×2000000.034.730.042.024.0
void Payload();2000000.021.323.020.09.0
void Payload(int);2000000.018.130.032.024.0
void Payload(int);×2000000.037.036.056.029.0
void Payload(int, int, float);2000000.037.438.062.016.0
void Payload(int, int, float);×2000000.056.432.068.016.0
float Payload(int, int, float);2000000.330.125.072.036.0
float Payload(int, int, float);×2000000.341.430.095.025.0
float Payload();2000000.217.829.034.027.0
float Payload();×2000000.238.333.059.014.0
Quaternion Payload(Transform);20000024.387.393.058.046.0
Quaternion Payload(Transform);×20000024.2100.090.060.046.0
Quaternion Payload(Transform, float, float, float);20000043.1102.298.085.048.0
Quaternion Payload(Transform, float, float, float);×20000043.0112.699.088.049.0
Quaternion Payload(Transform, Vector3);20000024.2103.7152.072.047.0
Quaternion Payload(Transform, Vector3);×20000024.3118.3149.073.049.0
fibonacci(40);1640.820771.11899.01888.01887.0
payload(): number // ScriptCallScript200000000245.39350.3183.0182.0182.0

ios (iPhone XsMax)

MethodStaticCallcsharpxLuapuer Spuer X Rpuer X S
void Payload();×2000000.010.228.027.024.0
void Payload();2000000.025.834.034.026.0
void Payload(int);2000000.010.727.030.022.0
void Payload(int);×2000000.021.230.033.023.0
void Payload(int, int, float);2000000.012.334.047.026.0
void Payload(int, int, float);×2000000.023.936.050.028.0
float Payload(int, int, float);2000000.010.443.072.034.0
float Payload(int, int, float);×2000000.032.143.073.036.0
float Payload();2000000.311.029.046.025.0
float Payload();×2000000.316.431.049.027.0
Quaternion Payload(Transform);20000034.068.799.072.062.0
Quaternion Payload(Transform);×20000034.983.5100.074.067.0
Quaternion Payload(Transform, float, float, float);20000063.378.5108.0101.083.0
Quaternion Payload(Transform, float, float, float);×20000063.689.7107.0102.075.0
Quaternion Payload(Transform, Vector3);20000035.978.8159.088.064.0
Quaternion Payload(Transform, Vector3);×20000034.895.8168.088.069.0
fibonacci(40);1500.820580.617513.017315.017474.0
payload(): number // ScriptCallScript200000000282.39093.210896.010502.010851.0