First, please quote your code.
I your problem truly has this simple structure, then I would guess that compile time would be dominated by O(1) factors; since there is nothing to infer. Also, a global A
may be the source of most of your performance problems at runtime.
But why aren’t you using something like
(kwarg1 || kwarg2 || ...) ? A : nothing
or even
dummy(; kwargs...) = any(values(kwargs)) ? A : nothing