Hacker News new | ask | show | jobs
by pcwalton 3991 days ago
> There may possibly be a problem with unnecessarily slowing startup times in the case you don't need the singleton - in which case, profiling will tell you and you can revert to the method in the blog post.

Not just in that case. If you lazily initialize then you can get other things done before—or while—you're waiting for the singleton constructor to run. Global constructors are suboptimal for performance almost as a rule.