Oh neat, just realized `log` + `bumpalo` probably work really well together! Each time a message is created it can be stored in the bump allocator. Then every n messages, or when `Log::flush` is called we take a lock on stdout, write all messages, and reset the allocator!
Tested this and it turns out Bumpalo makes use of `Cell` under the hood to keep track of access (makes sense!) However this means we cannot use this across threads unless we wrap it in a Mutex.. which is exactly what we were trying to avoid!
-
-
The reason why it needs to be thread-safe is b/c `log::Log: Send + Sync` https://docs.rs/log/0.4.8/log/trait.Log.html … It seems the *right* solution here would be to build a thread-safe bump allocator. It should be possible to build a lock-free version. But not even going to attempt building it hah.
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.