Skip to content

v3.5.7 - Optimize StackTrace capture #432

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

gmpassos
Copy link

@gmpassos gmpassos commented Jun 29, 2025

v3.5.7

  • PgSessionBase:

    • Optimize _prepare by passing the already captured StackTrace to _sendAndWaitForQuery.
  • Added ResultStreamTrace:

    • A ResultStream that adds a callerTrace parameter to the listen method.
  • _BoundStatement now implements ResultStreamTrace rather than ResultStream.

  • _PgResultStreamSubscription: added an optional callerTrace parameter to its constructors.

  • PreparedStatement:

    • Optimized run and _closePendingPortals by reducing StackTrace captures.

- `PgSessionBase`:
  - Optimize `_prepare` by passing the already captured `StackTrace` to `_sendAndWaitForQuery`.
gmpassos added 4 commits June 29, 2025 06:31
  - A `ResultStream` that adds a `callerTrace` parameter to the `listen` method.
…esultStream`.

- `_PgResultStreamSubscription`: added an optional `callerTrace` parameter to its constructors.
  - Optimized `run` and `_closePendingPortals` by reducing `StackTrace` captures.
@gmpassos
Copy link
Author

gmpassos commented Jun 29, 2025

@isoos

With this PR, the StackTrace bottleneck was reduced to about 1%:

image

Detailed:

image

Previous (postgres v3.5.6):

Image

@gmpassos
Copy link
Author

Note, this PR is just reducing unnecessary calls to StackTrace.current

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.

1 participant