Skip to content

Feature: Add ProfilingData object cache in Profiler#99

Merged
glensc merged 2 commits into
perftools:mainfrom
glensc:cache-profiledata
May 11, 2026
Merged

Feature: Add ProfilingData object cache in Profiler#99
glensc merged 2 commits into
perftools:mainfrom
glensc:cache-profiledata

Conversation

@glensc
Copy link
Copy Markdown
Contributor

@glensc glensc commented May 9, 2026

This is benefical for long running apps like Laravel Octane.

This is benefical for long running apps like Laravel Octane.
@glensc glensc self-assigned this May 9, 2026
@glensc glensc requested a review from Copilot May 9, 2026 11:48
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a cached ProfilingData instance inside Profiler to avoid repeatedly constructing ProfilingData on each disable() call—intended to help performance in long-running PHP processes (e.g., Laravel Octane).

Changes:

  • Introduce Profiler::$profilingData and a private getProfilingData() lazy-initializer to reuse a single ProfilingData instance.
  • Update Profiler::disable() to use the cached ProfilingData instance.
  • Add a unit test asserting getProfilingData() returns the same cached instance across calls.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Profiler.php Adds a cached ProfilingData property and accessor; disable() now reuses it.
tests/ProfilerTest.php Adds a reflection-based test to verify the ProfilingData instance is cached.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Profiler.php
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@glensc glensc merged commit 330a772 into perftools:main May 11, 2026
13 checks passed
@glensc glensc deleted the cache-profiledata branch May 11, 2026 09:08
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