@@ -438,12 +438,18 @@ function chartDisplayName(key: ChartKey): string {
438438 }
439439}
440440
441+ /** Benchmarks run at several scale factors, so their file-size charts always name it. */
442+ const SCALED_FILE_SIZE_BENCHMARKS : ReadonlySet < string > = new Set ( [ 'tpch' , 'tpcds' , 'tpch-nested' ] ) ;
443+
441444/**
442- * A file-size chart's name: the benchmark, with its scale factor unless it is the default `1.0`.
443- * The monorepo's capture script records `1.0` for a benchmark with no scale-factor directory.
445+ * A file-size chart's name: the benchmark, with its scale factor unless it is the default `1.0`
446+ * of a benchmark with no scale factors. The monorepo's capture script records `1.0` for a
447+ * benchmark with no scale-factor directory.
444448 */
445449function fileSizeChartName ( benchmark : string , scaleFactor : string ) : string {
446- return scaleFactor === '1.0' ? benchmark : `${ benchmark } sf=${ scaleFactor } ` ;
450+ return scaleFactor === '1.0' && ! SCALED_FILE_SIZE_BENCHMARKS . has ( benchmark )
451+ ? benchmark
452+ : `${ benchmark } sf=${ scaleFactor } ` ;
447453}
448454
449455/** A chart's base `unit_kind`: sizes are bytes, everything else is a time. */
@@ -1236,12 +1242,13 @@ export interface GroupChartsResponse {
12361242 charts : NamedChartResponse [ ] ;
12371243}
12381244
1239- /** Canonical group order for the v4 site. Unknown groups sort last by name. */
1245+ /**
1246+ * Canonical group order for the v4 site. Unknown groups follow by name, then
1247+ * [`GROUP_ORDER_LAST`].
1248+ */
12401249const GROUP_ORDER : readonly string [ ] = [
12411250 'Compression' ,
12421251 'Compression Size' ,
1243- 'String Encoding' ,
1244- 'String Encoding Size' ,
12451252 'SQL File Size' ,
12461253 'Random Access (NVMe)' ,
12471254 'Random Access (S3)' ,
@@ -1264,14 +1271,21 @@ const GROUP_ORDER: readonly string[] = [
12641271 'appian [nvme]' ,
12651272] ;
12661273
1274+ /** Groups that sort after every other group, in this order: the string-bench groups. */
1275+ const GROUP_ORDER_LAST : readonly string [ ] = [ 'String Encoding' , 'String Encoding Size' ] ;
1276+
12671277/**
1268- * Sort key for a group name against [`GROUP_ORDER`]: names in the list sort by
1269- * position; names not in the list sort after, with an alphabetical tiebreak.
1270- * Mirrors the Rust `group_sort_key` `(usize, &str)` tuple.
1278+ * Sort key for a group name: names in [`GROUP_ORDER`] sort by position, then
1279+ * names in neither list alphabetically, then names in [`GROUP_ORDER_LAST`] by
1280+ * position. Mirrors the Rust `group_sort_key` `(usize, &str)` tuple.
12711281 */
12721282function groupSortKey ( name : string ) : [ number , string ] {
12731283 const pos = GROUP_ORDER . indexOf ( name ) ;
1274- return [ pos === - 1 ? GROUP_ORDER . length : pos , name ] ;
1284+ if ( pos !== - 1 ) {
1285+ return [ pos , name ] ;
1286+ }
1287+ const last = GROUP_ORDER_LAST . indexOf ( name ) ;
1288+ return [ last === - 1 ? GROUP_ORDER . length : GROUP_ORDER . length + 1 + last , name ] ;
12751289}
12761290
12771291/** Comparator over [`groupSortKey`] applying the canonical group ordering. */
@@ -1659,9 +1673,19 @@ async function collectVectorSearchGroups(): Promise<Group[]> {
16591673
16601674type FileSizeScopeRow = { benchmark : string ; scale_factor : string } ;
16611675
1676+ /** Benchmarks whose file-size charts lead the group, in this order; the rest follow by name. */
1677+ const FILE_SIZE_CHART_ORDER : readonly string [ ] = [ 'clickbench' , 'tpch' , 'tpcds' ] ;
1678+
1679+ /** A benchmark's position in the file-size group: its `FILE_SIZE_CHART_ORDER` index, else after. */
1680+ function fileSizeChartRank ( benchmark : string ) : number {
1681+ const pos = FILE_SIZE_CHART_ORDER . indexOf ( benchmark ) ;
1682+ return pos === - 1 ? FILE_SIZE_CHART_ORDER . length : pos ;
1683+ }
1684+
16621685/**
16631686 * The `SQL File Size` group: one chart per benchmark and scale factor, or `[]` if the table is
1664- * empty. Charts order by benchmark, then by numeric scale factor, so `10.0` follows `1.0`.
1687+ * empty. Charts order by [`FILE_SIZE_CHART_ORDER`], then by benchmark name, then by numeric
1688+ * scale factor, so `10.0` follows `1.0`.
16651689 */
16661690async function collectFileSizeGroup ( ) : Promise < Group [ ] > {
16671691 // A recursive skip scan of `idx_file_sizes_baseline`: one descent per scope instead of a scan
@@ -1691,6 +1715,7 @@ async function collectFileSizeGroup(): Promise<Group[]> {
16911715 }
16921716 rows . sort (
16931717 ( a , b ) =>
1718+ fileSizeChartRank ( a . benchmark ) - fileSizeChartRank ( b . benchmark ) ||
16941719 compareCodeUnits ( a . benchmark , b . benchmark ) ||
16951720 Number ( a . scale_factor ) - Number ( b . scale_factor ) ||
16961721 compareCodeUnits ( a . scale_factor , b . scale_factor ) ,
0 commit comments