#ModelSerializer or Serializer, Which one is better to use for performance issues?

8 messages · Page 1 of 1 (latest)

mossy walrus
#

REST framework
This article(https://hakibenita.com/django-rest-framework-slow) suggests that ModelSerializers are slower than general serializers.

According to this post's(https://www.reddit.com/r/django/comments/sesi0s/modelserializer_or_serializer_which_one_is_better/) discussion there is no significant difference 😦 and normal serializers performance is unstable and sometimes performs worse.

I wonder if anyone else tested it.

How we reduced serialization time by 99%!

Reddit

Explore this post and more from the django community

sour verge
#

If your model is not nested, using queryset.values is significantly faster than either

#

this is for read only purposes though

#

as in haki benita's article, passing read_only=True to model serializer also makes serialization faster

craggy grove
mossy walrus
tiny jetty
#

What is the API that you will be building that is using either model or general serializer.

I would think of that first before choosing either.

craggy grove