Skip to content

Commit 294fc47

Browse files
WebAssembly 2025 queries updates for counts and page ranking (#4328)
* For WebAssembly Report 2025, Updated all the queries from year (2021 & 2022) to the new schema where applicable. Added query for wasm usage counts by pages and by distinct wasm's names (counts.sql & counts_distinct_name.sql) Added query for various compression methods (compression_methods.sql) Added query for wasm component usage for domains and cross domains (domains.sql & cross_domain.sql) Added query for various instruction kinds (instruction_kinds.sql) Added query for various languages usage in wasm (language_usage.sql) Added query for various mimeType usage in wasm (mime_types.sql) Added query for page rankings (page_rankings.sql) Added query to understand usages by size (module_sizes.sql, section_sizes.sql, large_custom_sections.sql and total_sizes_by_percentile.sql) Info : Drop statustics for size_total_br, size_total_strip, size_total_strip_br, size_total_opt, size_total_opt_br, br_savings, strip_br_savings, opt_br_savings and opt_savings because of dataset has null values. Added query for wasm proposals.sql. Added query to understand popular wasm libraries in use. (popular_library_by_name.sql) All the queries are grouped by clients i.e. desktop and mobile. * Update sql/2025/webassembly/page_rankings.sql extended extra category Co-authored-by: Barry Pollard <barrypollard@google.com> * Updated query with date '2025-07-01', Removed test folder and Simplified json values without $ * rephrased query for compression methods by clients. * Refactor wasm count query * Update sql/2025/webassembly/page_rankings.sql Co-authored-by: Barry Pollard <barrypollard@google.com> * Added new line for code lint pipeline and rephrased queries * Apply suggestion from @tunetheweb * Apply suggestion from @tunetheweb * Apply suggestion from @tunetheweb * Apply suggestion from @tunetheweb * Apply suggestion from @tunetheweb * Apply suggestion from @tunetheweb * Update sql/2025/webassembly/instruction_kinds.sql * Update SQL query for distinct wasm origin count * Refactor SQL query for page rankings with cleaner syntax prefer to use rank_grouping instead of _rank * Lint --------- Co-authored-by: Barry Pollard <barrypollard@google.com>
1 parent c9c4804 commit 294fc47

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

sql/2025/webassembly/counts.sql

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
# Query for wasm requests' count with distinct wasm name
1+
# Query for wasm requests' count with distinct wasm origin name
22

33
WITH wasmRequests AS (
44
SELECT
55
client,
6+
page,
67
CASE
78
WHEN REGEXP_CONTAINS(url, r'/(hyphenopoly|patterns).*/[a-z-]{2,5}\.wasm')
89
THEN '(hyphenopoly dictionary)'
910
WHEN ENDS_WITH(url, '.unityweb')
1011
THEN '(unityweb app)'
1112
ELSE
1213
REGEXP_REPLACE(
13-
REGEXP_EXTRACT(LOWER(url), r'.*/([^./?]*)'), -- lowercase & extract filename between last `/` and `.` or `?`
14+
REGEXP_EXTRACT(LOWER(url), r'./([^./?])'), -- lowercase & extract filename between last `/` and `.` or `?`
1415
r'-[0-9a-f]{20,32}$', -- trim trailing hashes to transform `name-0abc43234[...]` to `name`
1516
''
1617
)
@@ -25,7 +26,7 @@ WITH wasmRequests AS (
2526
SELECT
2627
client,
2728
COUNT(0) AS total_wasm,
28-
COUNT(DISTINCT name) AS total_distinct_wasm
29+
COUNT(DISTINCT NET.REG_DOMAIN(page)) AS distinct_origin
2930
FROM
3031
wasmRequests
3132
GROUP BY
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1-
# Query to get count of pages which use wasm at page ranking intervals.
2-
31
SELECT
42
client,
5-
_rank AS rank_grouping,
3+
rank_grouping,
64
CASE
7-
WHEN _rank = 100000000 THEN 'all'
8-
ELSE CAST(_rank AS STRING)
5+
WHEN rank_grouping = 100000000 THEN 'all'
6+
ELSE CAST(rank_grouping AS STRING)
97
END AS ranking,
108
COUNT(DISTINCT page) AS pages
119
FROM
1210
`httparchive.crawl.requests`,
13-
UNNEST([1000, 10000, 100000, 1000000, 10000000, 100000000]) AS _rank
11+
UNNEST([1000, 10000, 100000, 1000000, 10000000, 100000000]) AS rank_grouping
1412
WHERE
1513
date = '2025-07-01' AND
1614
type = 'wasm' AND
17-
rank <= _rank
15+
rank <= rank_grouping
1816
GROUP BY
1917
client,
20-
rank
18+
rank_grouping
2119
ORDER BY
22-
rank
20+
client,
21+
rank_grouping

0 commit comments

Comments
 (0)