AdCombo / flask-combo-jsonapi

Flask REST JSON:API on steroids.
MIT License
32 stars 16 forks source link

Using ToastedMarshmallow #26

Open Rishi321 opened 4 years ago

Rishi321 commented 4 years ago

Original question on Flapison: https://github.com/TMiguelT/flapison/issues/22

Has this library been tested with ToastedMarshmallow? We have been using this library to great effect recently in a project (for about 8 months), but we're now seeing some performance hits during the Marshmallow serialization (sometimes 100's of ms) when dealing with many objects (100's)

I've seen people talk about ToastedMarshmallow and notice that the compute_schema recreates schema instances everytime, according to the ToastedMarshmallow documentation this will reduce the gain heavily.

Is there a reason we recreate schema objects every time? If not, what would be the best way to change the code to allow one schema object per resource?

I tried changing the code and using an in-memory object dict as an object cache, but toastedmarshmallow still made no performance impact. Anybody tried this before?

Also posted here: miLibris#192

mahenzon commented 3 years ago

Hi! If you already have any code to provide for us to check, please do it.

I think we can make optional use of custom lib, so we can add some kind of flag to show the lib that we are using some custom implementation