Skip to content

feat: efficiency leaderboard, ranked by tokens per dollar - #118

Merged
nikshepsvn merged 1 commit into
mainfrom
feat/efficiency-metric
Aug 5, 2026
Merged

feat: efficiency leaderboard, ranked by tokens per dollar#118
nikshepsvn merged 1 commit into
mainfrom
feat/efficiency-metric

Conversation

@nikshepsvn

Copy link
Copy Markdown
Contributor

Lands the idea from #70 by @kevinfosterNG, reworked so the ranking is actually true.

Why it needed reworking

That PR sorted client-side over the ~25 rows already fetched, which answers "who is most efficient among the top 25 by cost" — a different and much less interesting question. It also forced hasMore to false (so the board silently offered fewer pages than it had) and scored zero-cost submissions as Infinity, which would pin a $0 row at #1 permanently.

Ranking now happens in the database on a stored tokens_per_dollar column — NULL for zero cost, so division by zero has no answer rather than a wrong one — with a partial index matching the query.

The spend floor is what makes it a metric

This came from looking at the data, not from theory. Unfiltered, the top of the efficiency board was:

tok/$ cost user
22,011,119 $28.89 psource /Users/pawelkiszczak/…/activate
8,791,586 $96.51 structurebased
7,070,202 $0.01 aayushlovesfj

Against a median of 1.2M tok/$. Those are rounding errors, not ways of working.

Above $100 the ranking spans $112 to $11K of real spend (4.1M → 2.6M tok/$) and reads as a genuine second axis — which matters on a board whose #1 by cost is a $205K outlier.

Date filters

Efficiency is disabled while a date filter is active rather than quietly falling back. The date-range board aggregates daily rows and has no stored ratio to order by, so offering the toggle there would show a cost ranking under an efficiency label. Selecting a date range while on efficiency drops back to cost, so the lit toggle never disagrees with the rows.

Separate finding

That $28.89 row is a username that's a shell fragmentpsource /Users/pawelkiszczak/Projects/…/activate. Someone's git config user.name picked up corrupted text and it's now a public leaderboard entry. Filing separately; not fixed here.

Verified against production through the anon key the browser actually uses: 1,030 eligible submissions, correctly ordered, noise excluded. Migration 011 applied. npm test, tsc, eslint, next build clean.

🤖 Generated with Claude Code

Lands the idea from #70 by kevinfosterNG, reworked so the ranking is true.

That PR sorted client-side over the ~25 rows already fetched, which answers
"who is most efficient among the top 25 by cost" rather than "who is most
efficient" — and it forced hasMore to false, so the board silently offered
fewer pages than it had. It also scored zero-cost submissions as Infinity,
which would pin a $0 row at #1 permanently.

Ranking now happens in the database on a stored tokens_per_dollar column,
NULL for zero cost so division by zero has no answer instead of a wrong one,
with a partial index matching the query.

The spend floor is the part that makes this a real metric rather than a noise
generator, and it came from looking at the data: unfiltered, the top of the
efficiency board was a $0.01 submission at 7M tokens/$ against a median of
1.2M — the ratio of a rounding error. Above $100 the ranking spans $112 to
$11K of real spend and reads as a genuine second axis, which matters on a
board whose #1 by cost is a $205K outlier.

Efficiency is disabled while a date filter is active rather than quietly
falling back: the date-range board aggregates daily rows and has no stored
ratio to order by, so offering the toggle there would show a cost ranking
under an efficiency label. Selecting a date range while on efficiency drops
back to cost so the lit toggle never disagrees with the rows.

Verified against production through the anon key the browser actually uses:
1030 eligible submissions, correctly ordered, noise rows excluded.

Co-Authored-By: kevinfosterNG <kevinfosterNG@users.noreply.github.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
viberank Ready Ready Preview Aug 5, 2026 1:25pm

Request Review

@nikshepsvn
nikshepsvn merged commit 8cdc651 into main Aug 5, 2026
2 checks passed
@nikshepsvn
nikshepsvn deleted the feat/efficiency-metric branch August 5, 2026 13:26
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