Suggestion: Migrating from ActiveModelSerializers to Alba

Hi, I just noticed that Discourse uses older version of ActiveModelSerializer.
It was released five years ago and I don’t think it’s good.

It seems that it’s planned to fork AMS but there’s a better solution.
My suggestion here to migrate from AMS to Alba, a JSON serializer I created and maintain. Although Alba is not 100% compatible with AMS, the API it offers is similar to AMS and about 10 times faster than latest AMS.

If the maintainers agree on migration, I’ll send a PR.


Could you change 2 or 3 endpoints over to it in PR and run some benchmarks? That may help us to evaluate it :smiley:


Yes, as Falco mentioned we need to worry about 2 areas here:

  1. Plugin compatibility - many plugins extend serializers, we would like to minimize breaking changes

  2. Performance - changing serializers needs to be backed with hard data.

I recommend looking at some of the serializers involved in topic or topic list pages and using them as testing grounds:

Then use “before” and “after” figures of discoruse bench. It will give you a very accurate feel of the progress made.

The amount of ecosystem disruption we are open to accepting heavily depends on the performance improvement here.