Add CoreCachedWeakPtr::lock() method, improve benchmarks
Summary: Currently `CoreCachedWeakPtr` only exposes `get()`, which returns by value, so to lock the pointer we need to do two refcount operations, one on the weak count and one on the shared count. This is expensive. We could return by `const&`, but I don't want to expose the internal state, as we may be able to optimize the footprint by relying on implementation details of `std::shared/weak_ptr` in the future. Instead, expose a natural `lock()` method. Also, improve the benchmarks: - Add comparison with `ReadMostlySharedPtr` - Ensure that all threads are busy for the same time, so that wall time * `numThreads` is a good approximation of overall CPU time. Reviewed By: philippv Differential Revision: D29762995 fbshipit-source-id: 851a82111e2726425e16d65729ec3fdd21981738
Showing
This diff is collapsed.
Please register or sign in to comment