-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
Description
Problem
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.