Page MenuHomePhabricator

Statistic: Initialize in the constructor
AbandonedPublic

Authored by MatzeB on Dec 13 2016, 11:41 AM.

Details

Summary

Statistics should be fast enough that we can enable them in release builds without compiletime impact. This does not work today because the lazy initialization in use today puts a memory fence on every increment operation!

The obvious solution for this is initializing the statistic variable in the constructor. Which is easy to do and works better in every way than todays code IMO except that introduce additional static constructors into llvm which in this specific instance look fine to me; the alternative of forbidding global variables for statistic variables appears arguably worse.

Diff Detail

Repository
rL LLVM

Event Timeline

MatzeB updated this revision to Diff 81267.Dec 13 2016, 11:41 AM
MatzeB retitled this revision from to Statistic: Initialize in the constructor.
MatzeB updated this object.
MatzeB added reviewers: chandlerc, dblaikie, echristo.
MatzeB set the repository for this revision to rL LLVM.
MatzeB added a subscriber: llvm-commits.
MatzeB abandoned this revision.Sep 26 2017, 2:11 PM

People don't seem to accept static constructors for this.