One more optimization tip: never use the tag() expression function. Wherever you think you need it, move its result to an indirect tag binding, on a custom property if necessary, and use that property’s value instead.
The tag() expression function is a backwards-compatibility function with less than ideal behavior.