freelawproject / courtlistener

A fully-searchable and accessible archive of court data including growing repositories of opinions, oral arguments, judges, judicial financial records, and federal filings.
https://www.courtlistener.com
Other
550 stars 151 forks source link

Profile the performance of the ES response-serialization API and the frontend template-rendering code. #4708

Open albertisfu opened 2 days ago

albertisfu commented 2 days ago

A user pointed out that our ES results serialization for rendering API requests might be slower than necessary because it involves converting dictionaries to Python objects in the DRF serializer and then back to dictionaries when sending data to the client. This process could be slower than avoiding the conversion to Python objects by using custom code for our serializer. Therefore, we should profile the performance of this related code to compare both approaches.

Additionally, we could further analyze the issue by considering that the ES response is already a Python object based on a custom AttrDict class. It might be possible to eliminate the Python objects earlier in the process and use dictionaries downstream if this improves performance and simplifies the code.