-
Couldn't load subscription status.
- Fork 15
feat: Performance improvements #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
📊 Benchmark ResultsNote: Benchmarks compare PR against |



Depends on #60
Refactored Array Comparison Logic
The array comparison logic was refactored for better handling of empty arrays, reducing unnecessary iterations.
Optimized array key checks to more efficiently identify differences.
Improved Float Comparison
Logic for comparing float values was refactored to use epsilon handling, avoiding false positives or negatives when values are mathematically very close but not exactly equal.
Additional edge case tests were added, especially around comparisons involving PHP_FLOAT_MAX and infinity.
Overall Performance Gains
All but 2 benchmarks show performance improvements, with most being substantial:
Improvements (>10% faster):
Minor Regressions (slower):
However, these two regressions are on edge cases (completely different arrays and empty arrays), which are less common in real-world usage.
Key Observations:
Real-world scenarios improved significantly: The realistic user dataset (-14.05%) and complex nested configuration (-12.73%) benchmarks show strong improvements in practical use cases.
Consistent improvements across sizes: Small (-14.30%), medium (-18.79%), and large (-14.22%) arrays all showed substantial improvements.
Wide arrays saw major gains: The -18.60% improvement on wide arrays (100 keys) is particularly impressive.
Variance improvements: Many benchmarks also show reduced standard deviation (rstdev), indicating more consistent performance:
The optimizations are clearly effective across most scenarios, yielding speed improvements of 10-28% in typical use cases. The minor regressions in edge cases are a worthwhile trade-off for the substantial gains elsewhere.