attrset ? "key"
and attrset.key or fallback
have nearly equal complexity costs
if attrset ? "key" then attrset.key else fallback
is slightly more expensive,
due to being 3 AST nodes (an ExprIf
with an ExprOpHasAttr
as the condition and then an ExprSelect
to extract the "key")
attrset.key or fallback
is slightly cheaper, since it is a single AST node (just ExprSelect
)