Make NodeRareData::rareDataMap a non-inline function
Created attachment 71196 [details] Patch NodeRareData::rareDataMap is an inline function with a static local variable. So, it will be unnecessarily duplicated in each compilation unit. It should be moved to a source file.
How did you assess performance implications of this change? > So, it will be unnecessarily duplicated in each compilation unit. That's a burden on the linker, but should be fine otherwise.
(In reply to comment #2) > How did you assess performance implications of this change? I hadn't considered it in terms of performance. I was looking at it from the perspective of having multiple, different copies of dataMap. > > So, it will be unnecessarily duplicated in each compilation unit. > > That's a burden on the linker, but should be fine otherwise. Unless I'm confused, won't the compiler generate a separate copy of the dataMap static variable for every source file that includes NodeRareData.h and calls NodeRareData::rareDataMap?
Comment on attachment 71196 [details] Patch And after a little poking around it appears I was confused. Sorry for the hassle.
Yes, the compiler will generate multiple copies - but then the linker will merge them all (I'm pretty sure this works with any reasonable toolchain). I'm not sure how much effect this has on linking performance, but it doesn't affect correctness.