Remove unnecessary data in the payload when combining related queries before sending it to the server. This would improve overall performance decreasing network latency and server processing.
This version also includes a new environmental variable to disable this feature. Please use it if you want to compare results or if you are getting any unexpected behavior.
In my first tests, I added 40 fake tests to a project dict and with this feature applied, the result time decreased from 0.4285s to 0.2598s
# Getting project fields
project_fields = list(sg.schema_field_read("Project").keys())
# Getting a project
sg_full_project = sg.find_one('Project', [['id', 'is', PROJECT_ID]], project_fields)
# At this point, `sg_full_project` can be "hacked" with more unnecessary fields to simulate a larger payload.
# Getting an asset
sg_asset = sg.find('Asset', [['project', 'is', sg_full_project]])
# A/B test
os.environ["SHOTGUN_API_DISABLE_ENTITY_OPTIMIZATION"] = "1"
sg_asset_no_optimization = sg.find('Asset', [['project', 'is', sg_full_project]])
Summary
Remove unnecessary data in the payload when combining related queries before sending it to the server. This would improve overall performance decreasing network latency and server processing.
Affected methods
Detailed Description
The change should transform calls like:
as if the following had been called:
This version also includes a new environmental variable to disable this feature. Please use it if you want to compare results or if you are getting any unexpected behavior.
Testing
Install this
v3.7.0-beta.1
version.In my first tests, I added 40 fake tests to a project dict and with this feature applied, the result time decreased from 0.4285s to 0.2598s
TODO