Skip to content

Commit 67ec6f7

Browse files
committed
feat: add sorting on mem usage and exec time
1 parent f780f5a commit 67ec6f7

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/components/leaderboard/Leaderboard.tsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,22 @@ const Leaderboard: React.FC<LeaderboardProps> = ({ benchmarkId }) => {
6363
return 1;
6464
}
6565
return 0;
66+
case 'execDuration':
67+
if (row1.execDuration! < row2.execDuration!) {
68+
return -1;
69+
}
70+
if (row1.execDuration! > row2.execDuration!) {
71+
return 1;
72+
}
73+
return 0;
74+
case 'memUsage':
75+
if (row1.memUsage! < row2.memUsage!) {
76+
return -1;
77+
}
78+
if (row1.memUsage! > row2.memUsage!) {
79+
return 1;
80+
}
81+
return 0;
6682
}
6783
return 0;
6884
}
@@ -223,7 +239,7 @@ const Leaderboard: React.FC<LeaderboardProps> = ({ benchmarkId }) => {
223239
<th
224240
scope="col"
225241
className="dark:text-gray-100 px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
226-
onClick={() => setSortedField('lintScore')}
242+
onClick={() => setSortedField('memUsage')}
227243
>
228244
<div className="flex">
229245
Memory usage
@@ -237,7 +253,7 @@ const Leaderboard: React.FC<LeaderboardProps> = ({ benchmarkId }) => {
237253
<th
238254
scope="col"
239255
className="dark:text-gray-100 px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
240-
onClick={() => setSortedField('lintScore')}
256+
onClick={() => setSortedField('execDuration')}
241257
>
242258
<div className="flex">
243259
Exec time

0 commit comments

Comments
 (0)