You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With all of this we can pass the CEL program to the TableConvertor's `ConvertToTable()` method, which will call `FindResults` and `PrintResults` for all additionalPrinterColumns, regardless of whether they're defined with JSONPath or CEL expressions.
727
727
728
-
### Cost Calculation and benchmarking performance with JSONPath
728
+
729
+
### CEL vs JSONPath Performance Analysis
729
730
730
731
A big part of the discussions for our proposal was the CEL cost limits since this is the first time CEL is added to the read path. As part of this we've done some benchmarking of the time it takes to parse and compile equivalent JSONPath and CEL expressions.
731
732
733
+
For the performance analysis, we introduced two new benchmark tests to the `tableconvertor_test.go` file – `Benchmark_CEL` and `Benchmark_JSONPath`.
734
+
735
+
Please find the raw output of the benchmark tests, as well as the code for executing them in the following gist:
|**Column Definition**|`self.spec.servers.map(s, s.hosts.filter(h, h == "prod.example.com"))`|`.spec.servers[*].hosts[?(@ == "prod.example.com")]`|
773
+
|**Overall Performance**<br>(Compilation + Evaluation) | • Average iterations: 3,111 <br> • Average time per operation: **382,914 ns/op** (~383 µs per op) <br> • Standard deviation: ±42,087 ns (±11%) | • Average iterations: 70,542 iterations <br> • Average time per operation: **17,654 ns/op** (~17.7 µs per op) <br> • Standard deviation: ±2,846 ns (±16%) |
_**Conclusion**_ — Across the 10 runs of the benchmark tests, on average, CEL is 20x slower than JSONPath (383µs vs 18µs).
779
+
780
+
When running the benchmark tests individually, we observed that CEL was consistently ~20-50x slower than JSONPath.
781
+
782
+
Based on these current findings, the end users should not find a noticeable difference in the performance when working with CEL for additionalPrinterColumns.
783
+
784
+
<!--
785
+
786
+
Hence, the end users might start seeing a non-negligible increase in the total time and CPU usage for apiserver when they are working with a large number of Custom Resources.
0 commit comments