Making each SingletonEntry a singleton
Summary: Most of the singleton construction logic is moved to SingletonEntry, and each SingletonEntry is now also a singleton. SingletonVault becomes only responsible for keeping singleton construction order (and potentially dependencies) and destoying them in correct order. This also significantly improves perf of get() / get_weak() (not-fast) This diff is based on D1823663. Test Plan: unit test ============================================================================ folly/experimental/test/SingletonTest.cpp relative time/iter iters/s ============================================================================ NormalSingleton 333.35ps 3.00G MeyersSingleton 99.99% 333.39ps 3.00G FollySingletonSlow 49.99% 666.84ps 1.50G FollySingletonFast 95.90% 347.61ps 2.88G FollySingletonFastWeak 2.22% 15.00ns 66.66M ============================================================================ Reviewed By: chip@fb.com Subscribers: trunkagent, folly-diffs@, yfeldblum FB internal diff: D1827390 Signature: t1:1827390:1423268514:da322d1dcaba54905d478b253f26dd76f890fb4e
Showing
This diff is collapsed.
Please register or sign in to comment