jkomoros / boardgame

An in-progress framework in golang to easily build boardgame Progressive Web Apps
Apache License 2.0
31 stars 4 forks source link

Use easyjson for performance? #496

Open jkomoros opened 7 years ago

jkomoros commented 7 years ago

We go to great lengths to avoid reflection in many parts of the library... but then use MarshalJSON and UnmarshalJSON, which have significant performance overhead.

Should we use e.g. https://github.com/mailru/easyjson, which uses generated code?

jkomoros commented 7 years ago

https://github.com/pquerna/ffjson might be better because it's a drop-in replacement for MarshalJSON/UnmarshalJSON

jkomoros commented 6 years ago

Another approach is to just have a MarshalJSON / UnmarshalJSON that takes a PropertyReadSetter / PropertyReadSetConfigurator and the blob that should match and deserializes. And benchmark to see how much faster that is.

jkomoros commented 6 years ago

Did this for generating json (in branch reader-json) and didn't have any appreciable performance difference. :-/

jkomoros commented 6 years ago

Another one to look into: https://github.com/valyala/fastjson