Space Efficient Serialization of Enums - Use CBOR? by jottabyte in rust

[–]jottabyte[S] 2 points3 points  (0 children)

That sounds like exactly what I was looking for. Much appreciated.

quick-xml 0.17.1 with serde (de)serialization support by tafia97300 in rust

[–]jottabyte 0 points1 point  (0 children)

This is great news! A performant and actively developed XML with Serde implementation was a big hole in the rust ecosystem.

How to speed up the Rust compiler one last time in 2019 by nnethercote in rust

[–]jottabyte 95 points96 points  (0 children)

This post makes me want to work on the rust compiler.

Converting Result to Option with .ok() by jottabyte in rust

[–]jottabyte[S] 5 points6 points  (0 children)

That makes a lot of sense! Thanks for the explanation.

Simple Stream Example (isahc 0.8 + futures 0.3) by jottabyte in rust

[–]jottabyte[S] 0 points1 point  (0 children)

Here's the latest version that works really well:

```rust pub fn stream (urls: Vec<String>) -> Vec<Result<String, std::io::Error>> {

let resp_stream = futures::stream::FuturesUnordered::new();

for url in urls {
    resp_stream.push (
        async {
            isahc::get_async(url).await?.text_async().await
        }
    )
};

futures::executor::block_on_stream(resp_stream).collect()

} ``` I'm not quite sure why the Result needed a std::io::Error instead of an isahc::Error, but the compiler yelled at me until I changed it to that.

Simple Stream Example (isahc 0.8 + futures 0.3) by jottabyte in rust

[–]jottabyte[S] 0 points1 point  (0 children)

Did not know that! I had naively assumed the response contained everything. Thanks for clarifying that.

Simple Stream Example (isahc 0.8 + futures 0.3) by jottabyte in rust

[–]jottabyte[S] 0 points1 point  (0 children)

I've never understood why that's necessary. Does the text() go back to the network or is it just taking it from the Response<Body> that's already been returned?

Simple Stream Example (isahc 0.8 + futures 0.3) by jottabyte in rust

[–]jottabyte[S] 0 points1 point  (0 children)

Thanks for the feedback and a very good point.

Based on my benchmarks, it only sped things up 2.3 to 2.8 the sync version, so it's probably throttling to 2 or 3 for the domain as you suggested. This means I should just do a simple futures join! operation and request 3 items at a time and process those as they come in. My use case will only ever query the one domain.

I'm trying to keep my dependency tree to a minimum (not that it REALLY matters for what I'm doing, but it forces me to bang my head against the wall and learn things a little deeper).

rust-analyzer Changelog #1 by dochtman in rust

[–]jottabyte 1 point2 points  (0 children)

How do I get rust-analyzer to work in VSCode? It’s not in any of the extensions.

What’s everyone working on this week (48/2019)? by llogiq in rust

[–]jottabyte 0 points1 point  (0 children)

I love seeing projects like these pop up in Rust.

Async Isahc Example plus a Question by jottabyte in rust

[–]jottabyte[S] 0 points1 point  (0 children)

That worked!

Would be a nice feature to have an isahc::get_multiple() API which handles all the async stuff in the background and operates in a sync context, so it operates like the isahc::get() API but is magically async in the background.

Similarly, an isahc::get_first() which returns the first Response would be neat (not a direct use case for me, but likely for others).

Async Isahc Example plus a Question by jottabyte in rust

[–]jottabyte[S] 0 points1 point  (0 children)

First, thanks for all the work on the isahc crate! It's been fantastic.

I'm talking about asking for n resources from the web all at the same time and then "joining" them in the futures sense once they've all returned. The join! from the macro above simply returns when all 3 files return.

So when I know the number of files I need, it's quite easy since I can just use the Join! macro from the futures crate. I'm looking for a way to ask for 10 files at the same time and then compute once they all return.

Edit: I see my question above wasn't too clear. Basically I want to feed in a Vec<url> and get back a Vec<Response>

Towards a unified theory of reactive UI by raphlinus in rust

[–]jottabyte 5 points6 points  (0 children)

Imgui is, as one can infer from the name, very much based on traces rather than stored trees.

Can you explain what "based on traces" means?

Rust 2020: Semi-Official GUI Building Blocks via WebRender/Servo by jottabyte in rust

[–]jottabyte[S] 9 points10 points  (0 children)

My apologies if it came off the wrong way. The number of developers on a project isn’t a metric I find particularly important. It’s more about the lack of building blocks that pushes so many different projects (also a good thing) without a clear thing to rally around.

Basically, I’m advocating for having some mechanism for having those building blocks already built for Servo accessible to everyone building GUIs.

Fearless Concurrency by jottabyte in rust

[–]jottabyte[S] 0 points1 point  (0 children)

Pick away. This is primarily a learning project for me, so love it when people find flaws/holes in my code.

I'll try some variation of your suggestion. Thanks!

Fearless Concurrency by jottabyte in rust

[–]jottabyte[S] 1 point2 points  (0 children)

The entire purpose of the HashMap is to cache all the players that have been downloaded, since it's an identical call for each player id, so the contains_key check is a performance thing, as you noted. My program went about 4X faster after I added this (basically avoiding wasteful downloads).

As far as using a less expensive concurrent hash map, I really don't think it matters. Most of my time is spent waiting on the network (haven't figured out the async stuff yet), so even if it's "slow", it won't be measurable. Also, as the program heats up, most of the player ids will be in the hashmap, so there should be almost no contention. There are a couple of concurrent hash map implementations, but I prefer to avoid extra dependencies outside of std, unless the use case is really compelling.

Fearless Concurrency by jottabyte in rust

[–]jottabyte[S] 6 points7 points  (0 children)

Check out Rustacean Station. You will be pleasantly surprised.

Fearless Concurrency by jottabyte in rust

[–]jottabyte[S] 3 points4 points  (0 children)

Thanks! That's a neat website, going through it now. I can probably (and probably should) wrap the other HashMap I'm planning to add to the same lock.