<div>The set-operations should be correct.</div><div><br></div>14% isn't all that much, considering how much this code is doing. It merges the sets of all strings and macros contained in the file and in _all_ of its includes (recursively). I also think that this code is mainly problematic on macro-heavy headers, so your test might not be representative. During most of my profilings, I got something around 5% I think.
<div><br></div><div>However, after I've already disabled most of the environment-management, I will have to rethink whether we really need all this information. At least the macro-sets are definitely required, but maybe we don't need the string-sets any more.</div>
<div><br></div><div>On an implementation level, there is not much room for optimizations.<br></div><div><br></div><div>Greetings, David</div>