Skip to content

Conversation

@clue
Copy link
Member

@clueclue commented Apr 29, 2018

This builds on top of the implementation approach in #115 and the ideas discussed in #46.

The $resolve and $reject callbacks passed to the resolver and cancellation functions of each promise now no longer cause a cyclic garbage reference in any exception trace as discussed in #46. This builds on top of the work done in #113. If you do not access any arguments, this PR has no effect (also no performance or memory penalty).

If you do access any of the arguments, you no longer have to care about these functions memory wise, as they will no longer cause a cyclic garbage reference. A similar patch has been introduced for the $progress callback in #115 and this means this now consistently applies to all callbacks.

Invoking the benchmarking example from #113 shows that this has little effect on performance (1M invocations that do no use arguments show no performance improvements, 1M invocations that do use arguments show a ~4% performance degradation).

This PR actually includes a test that shows how garbage memory references are no longer an issue in any supported PHP version and how these functions no longer cause any such references on their own (unlike the previous test in #115 this means that this requires no effort on the consumer side anymore).

@clueclue added this to the v2.6.0 milestone Apr 29, 2018
jsor
jsor approved these changes May 3, 2018
@jsorjsor merged commit 24cd9e8 into reactphp:2.xMay 3, 2018
@clueclue deleted the static-settle branch May 3, 2018 19:03
jsor added a commit to jsor-labs/pact that referenced this pull request May 16, 2018
This incorporates the work done by @clue in the following PR's for reactphp/promise: * reactphp/promise#115 * reactphp/promise#116 * reactphp/promise#117 * reactphp/promise#118 * reactphp/promise#119 Co-authored-by: Christian Lück <[email protected]>
jsor added a commit to jsor-labs/pact that referenced this pull request May 16, 2018
This incorporates the work done by @clue in the following PR's for reactphp/promise: * reactphp/promise#113 * reactphp/promise#115 * reactphp/promise#116 * reactphp/promise#117 * reactphp/promise#118 * reactphp/promise#119 Co-authored-by: Christian Lück <[email protected]>
@clueclue mentioned this pull request Jun 7, 2022
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@clue@jsor@WyriHaximus