You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is an edge case in schema translate where, if any part of the input data is parsed as a map[interface{}]interface{}, then data must be copied. This is because all of the JSON/YAML/TOML/etc. packages do not support encoding map[interface{}]interface{} objects. To allow translate to still work, the map[interface{}]interface{} object is converted to a map[string]interface{} object by
Making a new map[string]interface{}
Looping through the original map, inserting all the values into the new map (which has string keys instead of interface{} keys)
The conversion is so costly that translating an 8MB file takes 8 seconds on my ThinkPad T450s. This is not acceptable.
Possible Solutions
Write custom decoders and encoders which automatically attempt to convert interface{} keys to strings.
Find someone who knows more about Go's type system to refactor the current code so that data is cast to the correct type without copying it.
The text was updated successfully, but these errors were encountered:
Problem
There is an edge case in
schema translate
where, if any part of the input data is parsed as amap[interface{}]interface{}
, then data must be copied. This is because all of the JSON/YAML/TOML/etc. packages do not support encodingmap[interface{}]interface{}
objects. To allow translate to still work, themap[interface{}]interface{}
object is converted to amap[string]interface{}
object bymap[string]interface{}
interface{}
keys)The conversion is so costly that translating an 8MB file takes 8 seconds on my ThinkPad T450s. This is not acceptable.
Possible Solutions
Write custom decoders and encoders which automatically attempt to convert
interface{}
keys to strings.Find someone who knows more about Go's type system to refactor the current code so that data is cast to the correct type without copying it.
The text was updated successfully, but these errors were encountered: