Skip to content

perf: improves RingBuffer by using native PHP arrays#2159

Merged
Litarnus merged 1 commit into
masterfrom
ringbuffer-improvement
Jul 20, 2026
Merged

perf: improves RingBuffer by using native PHP arrays#2159
Litarnus merged 1 commit into
masterfrom
ringbuffer-improvement

Conversation

@Litarnus

Copy link
Copy Markdown
Contributor

Benchmarks showed that using regular PHP arrays compared to SplFixedArray improves pushing into the RingBuffer by around 2x and makes toArray significantly faster because we can utilise array_slice instead of iteration by hand.

We also get free copy-on-write mechanics since that's the default with PHP arrays.

@giortzisg giortzisg left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@Litarnus
Litarnus merged commit 26becd6 into master Jul 20, 2026
52 checks passed
@Litarnus
Litarnus deleted the ringbuffer-improvement branch July 20, 2026 09:13
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.

2 participants