Skip to content

Conversation

@samsonasik
Copy link
Owner

When data is SplFixedArray object, use ->toArray() instead of iterator_to_array().

Benchmark: SplFixedArray with 100000 elements
==================================================

Test 1: iterator_to_array()
  Average: 0.9139 ms
  Min: 0.8800 ms
  Max: 1.0941 ms

Test 2: SplFixedArray::toArray()
  Average: 0.3004 ms
  Min: 0.2842 ms
  Max: 0.3991 ms

==================================================
Comparison Results:
==================================================
iterator_to_array() is 204.27% slower
Speedup factor: 3.04x

Total time for 100 iterations:
  iterator_to_array(): 91.39 ms
  toArray(): 30.04 ms
  Difference: 61.35 ms

@samsonasik samsonasik merged commit 1e0c0e4 into main Dec 16, 2025
3 checks passed
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (c45927f) to head (1111ff8).
⚠️ Report is 49 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##                main       #34   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity        45        63   +18     
===========================================
  Files              4         5    +1     
  Lines            122       178   +56     
===========================================
+ Hits             122       178   +56     
Flag Coverage Δ
tests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@samsonasik samsonasik deleted the faster-splfixedarray branch December 16, 2025 08:46
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.

3 participants