The first change is reusing the same vector for all types. While we don't generally optimize for the multi-type case, it doesn't hurt here. The second change is avoiding calling the corresponding function if there are no curves of a certain type. This avoids creating attributes for types that aren't used, for example.