3 ms·
I mean, it'll produce similar assembly to C++ code that does the same, but grabbing a mutex for every log message is not going to give you amazing performance.
by comex 12y ago
I mean, it'll produce similar assembly to C++ code that does the same, but grabbing a mutex for every log message is not going to give you amazing performance. That's okay in this example, because the log seems to be compiled out by default and only used for debugging Servo, but if you're gunning for performance I'd suggest using thread-local storage to store logs per thread without any atomics and aggregating on a timer.
- killertypo 12y agotrue and it does suffer from deadlocking (which the author states is a possibility, if one thread never releases the mutex)! Either way, it is a very lightweight implementation and Rust does shine here.