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

Recycle NpgsqlDataReader instances #1649

Closed
roji opened this Issue Jul 21, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@roji
Member

roji commented Jul 21, 2017

Look into recycling the reader of a given command rather than instantiating a new one for each Execute*, this would allow ExecuteNonQuery (and possibly the others) to be zero-allocation. Problems:

  • The user might keep a reference to a closed/disposed NpgsqlDataReader, and it would become undisposed. Doesn't seem like a big problem.
  • Same command can be used with sequential or default, make sure to take that into account.

A different direction might be to remove the use of a reader in ExecuteNonQuery altogether. Unfortunately the reader currently performs some important logic that would have to be refactored out somehow - management of prepared statements on reception of the responses.

@roji roji added the performance label Jul 21, 2017

@roji roji added this to the 3.3 milestone Jul 21, 2017

@roji roji changed the title from Look into reducing memory overhead of Execute* to Look into recycling readers Mar 9, 2018

@roji roji closed this in 1768aa7 Mar 14, 2018

@roji roji changed the title from Look into recycling readers to Recycle NpgsqlDataReader instances Mar 14, 2018

@roji roji self-assigned this Mar 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment