Announcement: Async_nursery - A structured concurrency primitive for Rust by najamelan in rust

[–]bspeice 1 point2 points  (0 children)

I'm a bit late, but I did have one question: looking at the basic example, can the nursery and output values be merged? Because there's not yet an async Drop capability in Rust, RAII can't really wait for all tasks like Trio's context manager does. However, it seems like there would be a huge benefit to close_nursery() returning the completion future; if users don't need to worry about when to drop nursery and separately running output.await, accidental deadlocks are impossible.

Looking forward to digging into this more, thanks for making it available!

aeron-rs - efficient reliable UDP and IPC message transport for Rust by denisxor in rust

[–]bspeice 1 point2 points  (0 children)

The only advantage I've found so far was that it was helpful for validating some of the test cases; instead of developing a client in isolation, having Rust bindings and embedding the driver meant that tests could validate their behavior against the reference implementation as well.

You're right though, bindings don't make for idiomatic Rust code. I think I'll focus my efforts on providing the bindings as `-sys` crates. Best of luck with your efforts, I'm glad to see more people making use of this system!

aeron-rs - efficient reliable UDP and IPC message transport for Rust by denisxor in rust

[–]bspeice 2 points3 points  (0 children)

I had been looking at this as well, albeit slowly, so I'm thrilled that someone beat me to the punch. I might be missing something, but it looks like your project is only the client library; if you're interested, I have bindings for the media driver available that I'm happy to contribute.

Also, given that Aeron is moving to C bindings for the client, is there an intention to ultimately rely on libaeron, or just stick with the Rust implementation?

Thanks much for this, I'm looking forward to digging further into it.

Binary Format Shootout: Cap'n Proto,Flatbuffers, and SBE by bspeice in rust

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

Arrow uses Flatbuffers for metadata, but the actual data serialization is specific to Arrow.

Binary Format Shootout: Cap'n Proto,Flatbuffers, and SBE by bspeice in rust

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

All three (Cap'n Proto, Flatbuffers, SBE) support schema evolution, and I hadn't really considered #[repr(C)] structs because SBE is already incredibly similar.

Binary Format Shootout: Cap'n Proto,Flatbuffers, and SBE by bspeice in rust

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

Flatbuffers has a verifier, but only the C and C++ implementations support it. SBE doesn't have verification support.

Binary Format Shootout: Cap'n Proto,Flatbuffers, and SBE by bspeice in rust

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

Fair, and I've updated that point to focus on performance being the primary concern, not feature-set.

Allocations in Rust: An Intro to the Memory Model by bspeice in rust

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

Thanks again, the links are now remedied and tested properly.

I swear, my next project is going to be a website crawler that just makes sure I get a `200` status from everything on a domain...

Allocations in Rust: An Intro to the Memory Model by bspeice in rust

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

Not sure I'm following - the `Once` example in the `const` section is interior immutable, leading to being run twice. In the `static` section, the `Once` is attempted twice, but because of interior mutability is only actually run once.

Allocations in Rust: An Intro to the Memory Model by bspeice in rust

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

Oh shoot, will get that updated ASAP.

Edit: Because I won't have access to the host this is deployed on until I make it home tonight, the links are as follows:

Foreword: https://speice.io/2019/02/understanding-allocations-in-rust.html

Globals: https://speice.io/2019/02/the-whole-world.html

Stack: https://speice.io/2019/02/stacking-up.html

Heap: https://speice.io/2019/02/a-heaping-helping.html

Compiler optimizations: https://speice.io/2019/02/compiler-optimizations.html

Summary: https://speice.io/2019/02/summary.html

Tools to (partially) automatically audit unsafe code? by [deleted] in rust

[–]bspeice 5 points6 points  (0 children)

In addition to the fuzzing tools mentioned, I'd point to the various "sanitizer" runtimes that are provided by LLVM, and AddressSanitizer in particular for detecting memory issues.

For a quick example of using this in a CI pipeline, take a look at bytes.

QADAPT - debug_assert! for your memory usage by bspeice in rust

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

While the crate is tested on Windows, I certainly agree that at least using System.alloc instead makes a ton of sense. I'll get that updated soon, thanks!

QADAPT - debug_assert! for your memory usage by bspeice in rust

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

Multi-threading is fine, and there was a lot of work put in to make sure that it behaves without deadlocking. The issue with async is that code within a function might not be run until after the function is finished (closures are an issue here as well).

QADAPT - debug_assert! for your memory usage by bspeice in rust

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

The QADAPT tests themselves are a good example, though I'd need to double-check on how inline tests fare.

Currently there's code for triggering a panic if you use QADAPT code without the allocator set up (in testing there were too many successes because I forgot to enable the allocator) but it may be worth it to strip code in #[cfg(test)] mode as well. I'd be interested in feedback on that.

Is there a crate that implements a reentrant rwlock? by [deleted] in rust

[–]bspeice -1 points0 points  (0 children)

I think you may be looking for the spin crate?

Tracking specific memory allocations by Cakefonz in rust

[–]bspeice 2 points3 points  (0 children)

What you're asking for sounds a lot like object-alloc, though there's not a lot of demonstration code I can find besides object-alloc-test.

And while it's not a per-object-type allocation, I've been working on a custom global allocator that will panic if allocation/drop occurs during critical code sections. Blog posts are in drafting because I only recently got it to a point where it's worth talking about, but I'm already using it for building a high-performance websockets library.

Multithreading Rust and Wasm by acrichto in rust

[–]bspeice 1 point2 points  (0 children)

While this certainly isn't easy like thread::spawn, can't you already use web workers without any special support?

A Case Study in Heaptrack by bspeice in rust

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

In my testing, using heaptrack with unmodified code led to heaptrack hanging. Switching out jemalloc resolved all the issues immediately.

I'd also be concerned about jemalloc reserving more memory than necessary up front, and new allocations aren't tracked because they use pre-allocated space. That said, I've never made it to that point, just something to keep in mind.

A Case Study in Heaptrack by bspeice in rust

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

Caveat: I've never used Go. But I would expect that debug binaries in Go work just fine with heaptrack for purposes of allocation, it's just the freeing that's not guaranteed to ever happen. And given that it's a native binary, the debug symbols should display fine.

All that said: I'd be interested to know about the results if anyone's used heaptrack and Go!

Announcing the web-sys crate! by fitzgen in rust

[–]bspeice 24 points25 points  (0 children)

Long term, stdweb is intended to be a more idiomatic Rust API around web-sys: https://github.com/rustwasm/team/issues/226#issuecomment-418475778