镜像自: https://github.com/DragonOS-Community/thingbuf.git

Eliza Weisman 63825e6c53 refac: remove special empty state from slots (#25) há 3 anos atrás
.github 299011398b chore(ci): run the slowest loom models in separate jobs (#21) há 3 anos atrás
assets 853df894c2 docs: add benchmarks to readme há 3 anos atrás
bench 5b17c184b0 feat(mpsc): add support for statically-allocated MPSC channels (#23) há 3 anos atrás
bin 974f51e02f chore(test): fix loom script not forwarding args há 3 anos atrás
src 63825e6c53 refac: remove special empty state from slots (#25) há 3 anos atrás
tests 5b17c184b0 feat(mpsc): add support for statically-allocated MPSC channels (#23) há 3 anos atrás
.envrc 84b9ce7057 initial commit há 3 anos atrás
.gitignore 84b9ce7057 initial commit há 3 anos atrás
Cargo.toml 5b17c184b0 feat(mpsc): add support for statically-allocated MPSC channels (#23) há 3 anos atrás
README.md 853df894c2 docs: add benchmarks to readme há 3 anos atrás
default.nix 84b9ce7057 initial commit há 3 anos atrás
netlify.toml b6dbfdeee9 chore(docs): add Netlify docs builds há 3 anos atrás
shell.nix 84b9ce7057 initial commit há 3 anos atrás

README.md

Is it fast?

Yes, it's fast

FAQs

  • Q: Why did you make this?

A: For tracing, I wanted to be able to send formatted log lines to a dedicated worker thread that writes them to a file. Right now, we do this using crossbeam-channel. However, this has the sad disadvantage that we have to allocate Strings, send them through the channel to the writer, and immediately drop them. It would be nice to do this while reusing those allocations. Thus...StringBuf.

  • Q: Is it lock-free?

A: Extremely.

  • Q: Is it wait-free?

A: As long as you don't use the APIs that wait :)

  • Q: Why is there only a bounded variant?

A: Because unbounded queues are of the Devil.

  • Q: Isn't this just a giant memory leak?

A: If you use it wrong, yes.

  • Q: Why is it called that?

A: Originally, I imagined it as a kind of ring buffer, so (as a pun on "ringbuf"), I called it "stringbuf". Then, I realized you could do this with more than just strings. In fact, it can be generalized to arbitrary...things. So, "thingbuf".