json-logic-java
json-logic-java copied to clipboard
Construct JSON path only on exceptional cases.
This pull request addresses issue #63: Excessive object and memory allocations from string format operations during JSON logic evaluation.
Summary of Improvements
- Optimized
jsonPathConstruction:
Now,jsonPathis built only when exceptions are thrown, not on every evaluation step. - Reduced Usage of
String.format:
Frequent string formatting—previously responsible for a large portion of memory allocation—is now minimized. - Efficient String Manipulation:
Refactored string handling within the evaluation logic for improved efficiency. - Decreased Unnecessary Object Creation:
Memory profiles should reflect reduced object churn and overall improved allocation patterns. - No breaking changes: The public interfaces have not been changed. The change should not break any dependent library.
Benefits
- Lower Memory Footprint:
Dramatically reduces allocations related to string operations, easing runtime memory pressure. - Improved Performance:
Faster evaluations due to fewer expensive object and string operations. - Better Scalability:
Enhanced library stability and efficiency under heavy or high-throughput usage. - Targeted Exception Diagnostics:
jsonPathremains available for error handling and diagnostics, but is computed only as needed.