Open
Conversation
OpenAPI ChangesShow/hide ## Changes for v0.yaml: |
53d183c to
5dd8066
Compare
66eca49 to
3c0047c
Compare
gumaerc
requested changes
Feb 6, 2026
Contributor
gumaerc
left a comment
There was a problem hiding this comment.
I started by doing a basic performance benchmark on a filtered courses API request on this branch:
Running benchmark...
Request 1: 0.038005s
Request 2: 0.039411s
Request 3: 0.047653s
Request 4: 0.046338s
Request 5: 0.047911s
Request 6: 0.039506s
Request 7: 0.041502s
Request 8: 0.044114s
Request 9: 0.043823s
Request 10: 0.042039s
Request 11: 0.040209s
Request 12: 0.052176s
Request 13: 0.052879s
Request 14: 0.039724s
Request 15: 0.050184s
Request 16: 0.047651s
Request 17: 0.042509s
Request 18: 0.046008s
Request 19: 0.043229s
Request 20: 0.049614s
==========================================
Results:
==========================================
Min: 0.0380s
Max: 0.0529s
Average: 0.0447s
Median: 0.0440s
vs on main:
Running benchmark...
Request 1: 0.041241s
Request 2: 0.049858s
Request 3: 0.047197s
Request 4: 0.050239s
Request 5: 0.047043s
Request 6: 0.045739s
Request 7: 0.059040s
Request 8: 0.065837s
Request 9: 0.043678s
Request 10: 0.047911s
Request 11: 0.050948s
Request 12: 0.049941s
Request 13: 0.045670s
Request 14: 0.047399s
Request 15: 0.050467s
Request 16: 0.046239s
Request 17: 0.060257s
Request 18: 0.037534s
Request 19: 0.046157s
Request 20: 0.040043s
==========================================
Results:
==========================================
Min: 0.0375s
Max: 0.0658s
Average: 0.0486s
Median: 0.0473s
I ran this a bunch of times and the results seemed to be a bit faster subjectively when I was watching the output, both in the terminal and rendering the page.
|
|
||
| grade = serializers.FloatField(min_value=0.0, max_value=1.0) | ||
| grade = serializers.FloatField(read_only=True, min_value=0.0, max_value=1.0) | ||
|
|
Contributor
There was a problem hiding this comment.
To fix the OpenAPI spec issue, we could add letter_grade to the serializer here:
letter_grade = serializers.CharField(
read_only=True, max_length=6, allow_null=True
)The spec error is complaining about the max length being changed to unlimited from 6, so this fixes that.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What are the relevant tickets?
Part of https://github.com/mitodl/hq/issues/9559
Description (What does it do?)
This adds a couple of performance tweaks:
select_relatedtoprefetch_relatedNote that the OpenAPI checks are failing because I made some modifications to more explicitly specify grades and readonly to prevent drf_spectacular from putting an input type for grades into the spec (no idea why it was trying to do that) and while the check doesn't see an issue with that, it's taking issue with the fact that
maxLengthwas dropped as a result, which really never matters because it's read-only data.How can this be tested?