Skip to content

Conversation

@guidobrei
Copy link

This pull request addresses issue #63: Excessive object and memory allocations from string format operations during JSON logic evaluation.

Summary of Improvements

  • Optimized jsonPath Construction:
    Now, jsonPath is 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:
    jsonPath remains available for error handling and diagnostics, but is computed only as needed.

This PR is still a draft to demonstrate the idea. It lacks:

  • proper code formatting (my IDE reformatted the new code badly #blame-the-ide)
  • proper testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant