Skip to content

perf(serializer): Avoid unnecessary serialization of detached objects #431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 16, 2025

Conversation

JR-Morgan
Copy link
Member

@JR-Morgan JR-Morgan commented Jun 16, 2025

Previously, we were calling ujson.dumps for each object, for each transport.
Under normal circumstances, there are 2 transports (server + sqlite), which means everything was being serialized twice, which is not necessary.

This is in the hotpath; worth adressing.

Easy optimisation, with small but non-trivial performance improvement.
I don't understand cprofile's flame graph. It seems the size of the box doesn't properly correlate with the execution time.
But I'm seeing 33s -> 21s for ujson.dumps calls

Before:
image

After:
image

@JR-Morgan JR-Morgan requested a review from gjedlicska June 16, 2025 14:07
@JR-Morgan JR-Morgan marked this pull request as ready for review June 16, 2025 14:08
Copy link

codecov bot commented Jun 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.01%. Comparing base (3bcdf72) to head (1bd764d).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #431   +/-   ##
=======================================
  Coverage   90.01%   90.01%           
=======================================
  Files         130      130           
  Lines        6099     6100    +1     
=======================================
+ Hits         5490     5491    +1     
  Misses        609      609           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JR-Morgan JR-Morgan merged commit f5e024c into main Jun 16, 2025
7 checks passed
@JR-Morgan JR-Morgan deleted the jrm/optimisations branch June 16, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants