Skip to content

Conversation

@YiyanZhai
Copy link
Contributor

@YiyanZhai YiyanZhai commented Dec 5, 2025

This PR adds cumulative speedup totals to the original correctness view in author rankings tab.

The overall author ranking is calculated using the area under each author's Fast P curve.

Summary by CodeRabbit

  • New Features
    • Added author rankings section to the leaderboard, displaying aggregated performance metrics and speedup totals for each contributor
    • Introduced ranking visualization component providing a summarized view of author performance comparisons
    • Reorganized leaderboard tabs to feature author rankings with comparison data alongside existing metrics
    • Enhanced performance tracking with per-author speedup calculations for comprehensive performance analysis

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 5, 2025

Walkthrough

This change introduces per-author speedup metrics calculated via area-based integration of performance curves. The speedupSums field is computed in the analytics module, propagated through the leaderboard section, and used by the client to render an author rankings feature with a new OverallRankingCard component.

Changes

Cohort / File(s) Summary
Analytics speedup computation
web/apps/web/lib/analytics.ts
Added speedupSums: Record<string, number> field to AuthorCurvesResponse type. Updated computeFastPCurvesForAuthors to accumulate per-author speedup metrics using discrete trapezoidal-like integration of performance curves and include speedupSums in the return value.
Data propagation
web/apps/web/app/leaderboard/section.tsx
Added speedupSums: Record<string, number> field to DefinitionAuthorDetail type. Updated destructuring in computeFastPCurvesForAuthors call and propagates speedupSums through returned DefinitionAuthorDetail objects.
UI components and rankings
web/apps/web/app/leaderboard/client.tsx
Introduced OverallAuthorRanking and OverallRankingCardProps types. Added OverallRankingCard component for rendering ranked author summaries. Updated LeaderboardClient with memo calculations for correctnessByAuthor and overallRanking, changed tab from "correctness" to "rankings", and integrated new ranking card in tab content.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • web/apps/web/lib/analytics.ts: Verify the area-based speedup calculation logic (trapezoidal-like integration) computes correct cumulative speedup across curve points.
  • web/apps/web/app/leaderboard/client.tsx: Confirm memo dependency arrays for overallRanking and correctnessByAuthor are complete; verify filtering logic for excluded authors and positive comparison counts.
  • Data flow consistency: Ensure speedupSums is correctly threaded from analytics through section to client without data loss or type mismatches.

Possibly related PRs

  • feat(web): overall authors ranking #66: Implements the same overall authors ranking feature, modifying identical files and symbols (computeFastPCurvesForAuthors, AuthorCurvesResponse, DefinitionAuthorDetail.speedupSums, leaderboard components).
  • feat(web): interactive fast_p figure  #73: Modifies leaderboard fast-p codepaths and LeaderboardClient to add per-author/definition details; shares overlapping function and type changes.
  • feat: refine web app #80: Modifies the leaderboard analytics pipeline (computeFastPCurvesForAuthors, analytics types) and propagates new fields through leaderboard sections and client.

Poem

🐰 Speedups summed with curves so fine,
Authors ranked in a tidy line,
Trapezoidal magic, metrics bright,
Rankings gleam with author might!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: overall author rankings in leaderboard' directly and clearly describes the main change: adding overall author rankings to the leaderboard component, which is fully supported by the summary showing new OverallAuthorRanking type, OverallRankingCard component, and rankings tab updates.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @YiyanZhai, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the leaderboard by introducing a new 'Author rankings' tab. This tab provides an overall ranking of authors based on their cumulative speedup, calculated as the area under their Fast P curve across all workloads. This new metric offers a more holistic view of author performance, complementing the existing correctness view by highlighting consistent speed improvements.

Highlights

  • Overall Author Rankings: Introduced a new ranking system for authors based on cumulative speedup.
  • Speedup Calculation: Rankings are determined by the 'area under each author's Fast P curve,' representing total speedup.
  • Leaderboard UI Update: A new 'Author rankings' tab has been added to the leaderboard interface to display these new metrics.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new overall author ranking feature to the leaderboard, calculated as the area under the Fast-P curve. The changes span data computation in lib/analytics.ts and UI presentation in app/leaderboard/client.tsx. The implementation is solid, correctly calculating the area and displaying the new rankings. My feedback includes a suggestion to refactor a data transformation to a more modern functional style for better maintainability, and a fix for a duplicated UI component that appears in two different tabs.

Comment on lines +532 to +538
<OverallRankingCard
rankings={overallRanking}
maxTotalSpeedup={maxTotalSpeedup}
formatCoverage={formatCoverage}
title="Overall author rankings"
description="Area under the Fast-p curve across every workload; higher values mean more consistent speedups over the baseline."
/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The OverallRankingCard component is rendered in both the "Fast-p" tab and the "Author rankings" tab. This seems redundant. Based on the PR description, this new ranking card is intended for the author rankings view. To avoid duplication and keep the UI clean, it should probably only be displayed in the "Author rankings" tab.

Comment on lines +318 to +338
const overallRanking = useMemo<OverallAuthorRanking[]>(() => {
const entries: OverallAuthorRanking[] = []
const speedupEntries = Object.entries(fast.speedupSums ?? {})
for (const [author, totalSpeedup] of speedupEntries) {
if (excludedSet.has(author)) continue
const comparisons = fast.comparisonCounts[author] ?? 0
if (comparisons <= 0) continue
entries.push({
author,
totalSpeedup,
comparisons,
coverage: fast.coverage?.[author],
correctness: correctnessByAuthor[author],
})
}
return entries.sort((a, b) => {
if (b.totalSpeedup !== a.totalSpeedup) return b.totalSpeedup - a.totalSpeedup
if (b.comparisons !== a.comparisons) return b.comparisons - a.comparisons
return a.author.localeCompare(b.author)
})
}, [correctnessByAuthor, excludedSet, fast.comparisonCounts, fast.coverage, fast.speedupSums])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The overallRanking calculation can be rewritten using a more functional and declarative style with array methods like map, filter, and sort. This improves readability and avoids mutable state by removing the intermediate entries array.

  const overallRanking = useMemo<OverallAuthorRanking[]>(() => {
    return Object.entries(fast.speedupSums ?? {})
      .map(([author, totalSpeedup]) => ({
        author,
        totalSpeedup,
        comparisons: fast.comparisonCounts[author] ?? 0,
        coverage: fast.coverage?.[author],
        correctness: correctnessByAuthor[author],
      }))
      .filter((entry) => !excludedSet.has(entry.author) && entry.comparisons > 0)
      .sort((a, b) => {
        if (b.totalSpeedup !== a.totalSpeedup) return b.totalSpeedup - a.totalSpeedup;
        if (b.comparisons !== a.comparisons) return b.comparisons - a.comparisons;
        return a.author.localeCompare(b.author);
      });
  }, [correctnessByAuthor, excludedSet, fast.comparisonCounts, fast.coverage, fast.speedupSums])

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
web/apps/web/app/leaderboard/section.tsx (1)

25-34: Refactor: Extract shared type definition.

The DefinitionAuthorDetail type is defined in both this file (line 25) and in web/apps/web/app/leaderboard/client.tsx (line 20). Duplicate type definitions can lead to maintenance issues if the definitions diverge.

Consider extracting this type to a shared location, such as @/lib/analytics or a new @/app/leaderboard/types.ts file, and importing it in both files.

🧹 Nitpick comments (1)
web/apps/web/lib/analytics.ts (1)

298-331: LGTM: Area-under-curve calculation is mathematically sound.

The trapezoidal integration correctly computes the area under each author's Fast-p curve. The division by 200 appropriately averages the two percent values and converts from percentage to decimal.

Consider adding a brief comment explaining the integration formula for future maintainers:

     curves[author] = points

     let area = 0
+    // Trapezoidal integration: sum of (width × average_height) for each segment
     for (let index = 1; index < points.length; index++) {
       const prev = points[index - 1]
       const current = points[index]
       const width = current.p - prev.p
       if (width <= 0) continue
-      const height = (prev.percent + current.percent) / 200
+      const height = (prev.percent + current.percent) / 200  // Average percent as decimal
       area += width * height
     }
     speedupSums[author] = area

Also applies to: 342-342

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 25666b8 and 6c87697.

📒 Files selected for processing (3)
  • web/apps/web/app/leaderboard/client.tsx (8 hunks)
  • web/apps/web/app/leaderboard/section.tsx (3 hunks)
  • web/apps/web/lib/analytics.ts (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
web/apps/web/app/leaderboard/client.tsx (2)
web/apps/web/lib/analytics.ts (2)
  • CoverageStats (35-39)
  • CorrectnessSummary (7-13)
web/apps/web/components/fast-p-label.tsx (1)
  • FastPLabel (8-19)
web/apps/web/app/leaderboard/section.tsx (1)
web/apps/web/lib/analytics.ts (1)
  • computeFastPCurvesForAuthors (237-343)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Run unit tests on ubuntu-latest and Python 3.11
  • GitHub Check: Run unit tests on ubuntu-latest and Python 3.10
  • GitHub Check: Run unit tests on ubuntu-latest and Python 3.13
  • GitHub Check: Run unit tests on ubuntu-latest and Python 3.12
🔇 Additional comments (6)
web/apps/web/lib/analytics.ts (1)

27-27: LGTM: speedupSums field addition.

The new field correctly extends AuthorCurvesResponse to expose per-author cumulative speedup metrics.

web/apps/web/app/leaderboard/section.tsx (1)

67-67: LGTM: speedupSums propagation.

The destructuring and inclusion of speedupSums correctly threads the new field through the data flow.

Also applies to: 93-93

web/apps/web/app/leaderboard/client.tsx (4)

40-46: LGTM: OverallAuthorRanking type definition.

The type appropriately models the aggregated ranking data with optional coverage and correctness fields.


304-338: LGTM: Ranking computation logic is sound.

The correctnessByAuthor map and overallRanking computation correctly:

  • Build a lookup structure for per-author correctness
  • Filter excluded authors and zero-comparison entries
  • Sort by speedup (descending), then comparisons (descending), then author name (ascending)

611-663: LGTM: OverallRankingCard implementation.

The component correctly:

  • Normalizes bar widths relative to maxTotalSpeedup
  • Displays area value with 2 decimal places
  • Shows supplementary metrics (comparisons, coverage, pass rate)
  • Handles edge cases (no rankings, missing data)

98-98: LGTM: Tab restructure from "correctness" to "rankings".

The tab changes appropriately consolidate both speedup-based and correctness-based rankings under a unified "rankings" tab, improving the UI organization.

Also applies to: 371-371, 378-378, 541-548

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant