Skip to content

Feature: Add ProfilingData object cache in Profiler#99

Open
glensc wants to merge 2 commits intoperftools:mainfrom
glensc:cache-profiledata
Open

Feature: Add ProfilingData object cache in Profiler#99
glensc wants to merge 2 commits intoperftools: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.

glensc added 2 commits May 9, 2026 14:47
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
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