async icon indicating copy to clipboard operation
async copied to clipboard

Replace crossbeam with std::sync::mpsc

Open davidiw opened this issue 4 years ago • 5 comments

We're exploring options in the logging space. I was curious how amenable you folks would be to using std::sync::mpsc::sync_channel in favor of crossbeam?

davidiw avatar Mar 05 '20 06:03 davidiw

Why? We've just changed to crossbeam cuz it's better.

dpc avatar Mar 05 '20 07:03 dpc

In our attempt to minimize our dependencies :). I'm curious to learn more from your perspective.

davidiw avatar Mar 05 '20 07:03 davidiw

Wouldn't you just go without slog-async altogether? I mean, if you're minimizing dependencies for some particular reason, then having asynchronous logging might be something you could live without and log synchronously. If you really need async logging, you're probably already writing something „big“ and the chance something else will pull crossbeam-channel is quite high IMO.

I guess it would be possible to have crossbeam as a feature flag, though. It would complicate the code a little bit (they don't have the exact same interface), but should be technically possible. No idea if it's worth it.

vorner avatar Mar 05 '20 11:03 vorner

At some point crossbeam-channel will maybe become std::sync::mpsc, and we can switch back.

AFAIK crossbeam-channel is considerably better in terms of performance, and if anyone is using slog-async, I think that what they primary want (otherwise why bother with async at all).

Thanks for slog modular nature, there's really nothing stopping anyone from copy pasting slog-async source code into their own code and switching the queue too. Totally feasible: it's simple and tiny.

dpc avatar Mar 05 '20 18:03 dpc

On a related note, according to cargo-audit, crossbeam-channel version 0.5.3 has been yanked

Geobert avatar May 11 '22 09:05 Geobert