The performance comparison for which nobody asked
I got curious about the performance angle so I set up a test area of 110 assets (10 folders, each of which contains 10 folders). The Asset Listing Page version that @bkelly described I have set up with “Asset Map” sort order to make sure it spits out the same JSON as the keyword version.
I did two comparisons, one where the keywords were spitting out only the asset_assetid
for each asset, and one spitting out all the fields that @pixelmedia had in their original query asset_name,asset_assetid,asset_url,asset_type_icon,asset_data,asset_created_short,asset_data_metadata
I did 8 tests of each on an otherwise bare page using /_performance
110 assets x just asset_id
ALP
Total Time 0.22s, System 0.05s (22%), Queries: 0.13s (583)
Total Time 0.22s, System 0.05s (22%), Queries: 0.13s (583)
Total Time 0.22s, System 0.05s (24%), Queries: 0.14s (583)
Total Time 0.23s, System 0.05s (21%), Queries: 0.15s (583)
Total Time 0.22s, System 0.05s (22%), Queries: 0.14s (583)
Total Time 0.21s, System 0.05s (22%), Queries: 0.13s (583)
Total Time 0.23s, System 0.05s (22%), Queries: 0.14s (583)
Total Time 0.22s, System 0.05s (23%), Queries: 0.13s (583)
Keyword
Total Time 0.15s, System 0.02s (12%), Queries: 0.11s (544)
Total Time 0.15s, System 0.02s (13%), Queries: 0.11s (544)
Total Time 0.15s, System 0.02s (12%), Queries: 0.11s (544)
Total Time 0.16s, System 0.02s (12%), Queries: 0.12s (544)
Total Time 0.16s, System 0.02s (12%), Queries: 0.12s (544)
Total Time 0.15s, System 0.02s (12%), Queries: 0.12s (544)
Total Time 0.19s, System 0.02s (12%), Queries: 0.15s (544)
Total Time 0.16s, System 0.02s (12%), Queries: 0.11s (544)
110 assets x lots of fields
ALP
Total Time 1.65s, System 1.39s (84%), Queries: 1.17s (2272)
Total Time 1.47s, System 1.27s (86%), Queries: 1.08s (2272)
Total Time 1.32s, System 1.14s (87%), Queries: 0.96s (2272)
Total Time 1.64s, System 1.47s (89%), Queries: 1.17s (2272)
Total Time 1.36s, System 1.18s (87%), Queries: 0.99s (2272)
Total Time 1.51s, System 1.3s (86%), Queries: 1.08s (2272)
Total Time 1.32s, System 1.13s (86%), Queries: 0.97s (2272)
Total Time 1.36s, System 1.19s (88%), Queries: 0.99s (2272)
Keyword
Total Time 1.31s, System 0.03s (2%), Queries: 1s (2343)
Total Time 1.29s, System 0.03s (2%), Queries: 0.99s (2343)
Total Time 1.34s, System 0.03s (2%), Queries: 1.02s (2343)
Total Time 1.44s, System 0.03s (2%), Queries: 1.11s (2343)
Total Time 1.45s, System 0.03s (2%), Queries: 1.09s (2343)
Total Time 1.3s, System 0.03s (2%), Queries: 1s (2343)
Total Time 1.29s, System 0.03s (2%), Queries: 0.99s (2343)
Total Time 1.29s, System 0.03s (2%), Queries: 0.98s (2343)
When you’re not getting much data about each asset, the keyword method has a decent edge, but once you include useful fields in the output the gap really closes and the asset listing version ends up using fewer queries (although is still marginally slower).
A note on asset_children_link_type_1
While I was doing this test I noticed an issue in the regular expression set up. It had been using /"[a-z_]*":/
to pull out the "asset_children":
from the json, but once I restricted the link type that stopped working because it didn’t support digits in the json property "asset_children_link_type_1":
.
To make this method safe for type restricted keywords you need to change the regular expression to replace /"[a-z_12]*":/
instead.