Investigate serializer optimizations
Chalarangelo opened this issue · 0 comments
Chalarangelo commented
Motivation
Serializers are most commonly used in combination with JSON.stringify()
. The latter is known to be relatively slow. We could look into ways to optimize it. One such option would be to add schemas to the serializers and then leverage fastify/fast-json-stringify or lucagez/slow-json-stringify for example.
Proposal
TBD
Considerations
The serializer schema could borrow from the model schema. Anything essentially inherited from the model itself can be automatically generated for the schema and we can only require definitions for serializer keys that are custom. This might also push us towards moving serializers to only be a thin schema and make everything type-strict.