Minimal Benchmarking of IBM JSONata4Java vs doing the same work in native Java.
This benchmark is implemented using Java Microbenchmark Harness (JMH)
The aim was to calculate the average operation time and throughput.
- Ran three types of transformations (SIMPLE / COMPLEX / JOIN)
- Ran using 3 JVM Warmup Process and 5 Evaluated JVM Processes
- Each process runs 5 Warmup iterations and 5 Evaluated iterations
- Each iteration runs as many operations as possible for 10 seconds
Total Benchmarking Duration: 4 Hours 08 Minutes 39 Seconds
As per the benchmarking results,
- logic implemented natively in Java is between 2 and 3 orders of magnitude faster than the same logic implemented in JSONata.
- JSONata precompiled implementation is up to 1 order of magnitude faster than the compiled-at-runtime JSONata implementation.
- JSONata's implementation code is much more repeatable and flexible than the native implementation.
Despite JSONata seeming much slower than native implementation, most systems are not going to be doing this order of magnitude of processing anyway. So, the JSONata implementation is a good choice for most systems, because of its flexibility.
Further, pre-compiling the JSONata expressions in Java could lead to performance improvements, even if not as much as native implementation.