Skip to content

Expose more efficient async interfaces.#811

Merged
jaymell merged 1 commit intoredis-rs:mainfrom
amazon-contributing:expose-base-functions
Mar 25, 2023
Merged

Expose more efficient async interfaces.#811
jaymell merged 1 commit intoredis-rs:mainfrom
amazon-contributing:expose-base-functions

Conversation

@nihohit
Copy link
Copy Markdown
Contributor

@nihohit nihohit commented Mar 22, 2023

Since the async keyword can't be used in traits, the ConnectionLike trait requires that the returned futures be boxed. This is necessary for the trait, but not for usage of the concrete connections. This change allows users to use the core logic without boxing the futures, thus reducing allocations. For example, the ConnectionManager now uses MultiplexedConnection's send_packed_command, thus removing the unnecessary boxing and according to DHAT, reducing allocations by half.

Since the `async` keyword can't be used in traits, the ConnectionLike trait
requires that the returned futures be boxed. This is necessary for the
trait, but not for usage of the concrete connections. This change allows
users to use the core logic without boxing the futures, thus reducing
allocations. For example, the ConnectionManager now uses
MultiplexedConnection's `send_packed_command`, thus removing the
unnecessary boxing and according to DHAT, reducing allocations by half.
@nihohit nihohit force-pushed the expose-base-functions branch from 71b91ab to d38aa5c Compare March 22, 2023 14:59
@jaymell
Copy link
Copy Markdown
Contributor

jaymell commented Mar 25, 2023

Thanks, this looks great!

@jaymell jaymell merged commit 6472188 into redis-rs:main Mar 25, 2023
@nihohit nihohit deleted the expose-base-functions branch March 30, 2023 06:32
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.

3 participants