Skip to content

Commit 9b50ec9

Browse files
committed
readyset-psql: Update proxy benchmark to match recent changes
Since the actual readyset-psql code now gets PsqlValue directly from tokio_postgres instead of doing an intermediate conversion to DfValue, I'm updating this benchmark to match. This gives two benefits: - The benchmark performance will more accurately track what our real-world code is doing. - We eliminate the lingering dependency on TypedDfValue, which will let us get rid of some more boilerplate elsewhere in the code. Change-Id: I22d279149b23980b808c2f635d87684cf3f48f57 Reviewed-on: https://gerrit.readyset.name/c/readyset/+/5554 Reviewed-by: Jason Brown <[email protected]> Tested-by: Buildkite CI
1 parent 6fc7148 commit 9b50ec9

File tree

1 file changed

+9
-22
lines changed

1 file changed

+9
-22
lines changed

readyset-psql/benches/proxy.rs

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//! To run these benchmarks:
1010
//!
1111
//! ```notrust
12-
//! $ cargo criterion -p noria-psql --bench proxy
12+
//! $ cargo criterion -p readyset-psql --bench proxy
1313
//! ```
1414
1515
use std::net::SocketAddr;
@@ -27,7 +27,7 @@ use psql_srv::{
2727
Credentials, CredentialsNeeded, PrepareResponse, PsqlBackend, PsqlValue, QueryResponse,
2828
};
2929
use readyset_data::DfValue;
30-
use readyset_psql::{ParamRef, TypedDfValue};
30+
use readyset_psql::ParamRef;
3131
use tokio::io::{AsyncReadExt, AsyncWriteExt};
3232
use tokio::net::{TcpListener, TcpStream, ToSocketAddrs};
3333
use tokio::runtime::Runtime;
@@ -88,27 +88,14 @@ impl Stream for ResultStream {
8888

8989
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
9090
match self.get_mut() {
91-
ResultStream::Owned(iter) => Poll::Ready(iter.next().map(|r| {
92-
(0..r.len())
93-
.map(|i| TypedDfValue {
94-
col_type: r.columns()[i].type_().clone(),
95-
value: r.get(i),
96-
})
97-
.map(PsqlValue::try_from)
98-
.collect()
99-
})),
91+
ResultStream::Owned(iter) => Poll::Ready(
92+
iter.next()
93+
.map(|r| (0..r.len()).map(|i| Ok(r.get(i))).collect()),
94+
),
10095
ResultStream::Streaming(stream) => {
101-
Poll::Ready(ready!(stream.as_mut().poll_next(cx)).map(|res| {
102-
match res {
103-
Ok(r) => (0..r.len())
104-
.map(|i| TypedDfValue {
105-
col_type: r.columns()[i].type_().clone(),
106-
value: r.get(i),
107-
})
108-
.map(PsqlValue::try_from)
109-
.collect(),
110-
Err(e) => Err(e.into()),
111-
}
96+
Poll::Ready(ready!(stream.as_mut().poll_next(cx)).map(|res| match res {
97+
Ok(r) => (0..r.len()).map(|i| Ok(r.get(i))).collect(),
98+
Err(e) => Err(e.into()),
11299
}))
113100
}
114101
}

0 commit comments

Comments
 (0)