purescript-contrib/purescript-argonaut-generic

small optimization for encode

Opened this issue · 0 comments

Could the following two lines of code be switched around ?

$ FO.insert e.tagKey (fromString (reflectSymbol (Proxy :: Proxy name)))
$ FO.insert e.valuesKey values

Reason being that right now values come first in the encoded json and tag later. But for decoding it can potentially be faster to first get the tag to get of the type (FP) or class (OO) that the values have to be deserialized into.

Also for debugging it's nicer to see tag first and (potentially long) value string after that.