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
Some ad hoc testing shows that using something like this for deep copy beats many of the libraries that are actually built for this purpose (by a factor of at least 20 for github.com/mohae/deepcopy but over close to 100 for others). I know benchmarking is tricky but I do believe that sonic is quite performant, and I wonder if using it for copy can be faster still if the interim json representation can be skipped.
I would love to see a copy method in some form func Copy(src, dst any) err seems like a reasonable pattern.
Alternatively, is there any support for transforming to/from ast.Node from/to interfaces? (it looked like getting the ast.Node was only possible from json []byte via sonic.Get, and from it using node.MarshalJson()).
It may be that ast's intention to be "self-contained" means that it doesn't benefit from all of the Pretouch and asm optimizations… in any case, some mechanism of copying without serialization would be really helpful, and most likely the fastest mechanism available.
Some ad hoc testing shows that using something like this for deep copy beats many of the libraries that are actually built for this purpose (by a factor of at least 20 for github.com/mohae/deepcopy but over close to 100 for others). I know benchmarking is tricky but I do believe that sonic is quite performant, and I wonder if using it for copy can be faster still if the interim json representation can be skipped.
I would love to see a copy method in some form
func Copy(src, dst any) err
seems like a reasonable pattern.Alternatively, is there any support for transforming to/from
ast.Node
from/to interfaces? (it looked like getting the ast.Node was only possible from json[]byte
viasonic.Get
, and from it using node.MarshalJson()).The text was updated successfully, but these errors were encountered: