Skip to content
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

Make export of non-scalar values for events optional #5515

Closed
sebastianbergmann opened this issue Sep 16, 2023 · 3 comments
Closed

Make export of non-scalar values for events optional #5515

sebastianbergmann opened this issue Sep 16, 2023 · 3 comments
Assignees
Labels
feature/events Issues related to PHPUnit's event system type/enhancement A new idea that should be implemented
Milestone

Comments

@sebastianbergmann
Copy link
Owner

To address performance issues such as #5183 and sebastianbergmann/exporter#18 (comment), we changed the event system to not emit the Test\AssertionSucceeded and Test\AssertionFailed events when they do not have subscribers. The recently opened #5510 shows that there is at least one more performance issue related to the Test\AssertionSucceeded and Test\AssertionFailed events.

I discussed this issue with @theseer today and we came up with a different (hopefully better) solution to the performance issue that is rooted in exporting large object graphs to strings: instead of only emitting the events in question when they have subscribers, we would like to always emit them, but make the expensive export operation optional.

@sebastianbergmann
Copy link
Owner Author

@muzcb @Slamdunk Can you have a look whether this reintroduces the performance penalty again?

@sebastianbergmann
Copy link
Owner Author

It just occurred to me that we still use sebastian/exporter directly in Constraint::toString().

@sebastianbergmann
Copy link
Owner Author

As of 56e2355, Constraint::toString() only exports objects when needed (for assertion failure messages) or when explicitly requested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/events Issues related to PHPUnit's event system type/enhancement A new idea that should be implemented
Projects
None yet
Development

No branches or pull requests

1 participant