Skip to content
This repository has been archived by the owner on Oct 18, 2022. It is now read-only.

Very slow download #77

Open
cschramm opened this issue Jan 25, 2022 · 1 comment
Open

Very slow download #77

cschramm opened this issue Jan 25, 2022 · 1 comment

Comments

@cschramm
Copy link

xml-rs is freaking slow so that it slows down download rates for any connection with more than like 1 MBit/s (even locally!).

I successfully worked around that by implementing and using a Transport wrapper that just adds buffering to the stream:

struct BufTransport {
    inner: RequestBuilder,
}

impl Transport for BufTransport {
    type Stream = BufReader<<RequestBuilder as Transport>::Stream>;

    fn transmit(self, request: &Request<'_>) -> Result<Self::Stream, Box<dyn Error + Send + Sync>> {
        self.inner.transmit(request).map(BufReader::new)
    }
}

(RequestBuilder could be a generic Read of course)

As long as xml-rpc-rs sticks with xml-rs, I guess it's a good idea to use a BufReader in general. I can prepare a pull request if you like.

@cschramm
Copy link
Author

cschramm commented Jan 25, 2022

To add some numbers: With the standard RequestBuilder transport I observe download rates of about 0.5 MBit/s. With my BufTransport at first the network connection is the limit, then the network goes quiet and it takes a long unsatisfying processing time before I get back the result from call, but overall it's a rate of about 2 to 6 MBit/s locally (i.e. where the download phase is negligible).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant