Is your feature request related to a problem or challenge? Please describe what you are trying to do.
While reviewing other code, I noticed that cast_to_variant uses an inefficient column-oriented approach to building variant values. For primitive types this works ok, but for deeply nested types it means repeatedly creating new variants (and variant metadata), only to re-code them by copying the variant values to new arrays (with new metadata and field ids). Very expensive.
Describe the solution you'd like
Use a row-oriented builder approach, similar to what variant_get uses.
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
While reviewing other code, I noticed that
cast_to_variantuses an inefficient column-oriented approach to building variant values. For primitive types this works ok, but for deeply nested types it means repeatedly creating new variants (and variant metadata), only to re-code them by copying the variant values to new arrays (with new metadata and field ids). Very expensive.Describe the solution you'd like
Use a row-oriented builder approach, similar to what
variant_getuses.