build(ccusage): use nix for unix native fallback by ryoppippi · Pull Request #1318 · ccusage/ccusage · GitHub
Skip to content

build(ccusage): use nix for unix native fallback#1318

Open
ryoppippi wants to merge 5 commits into
mainfrom
codex/use-nix-native-builds
Open

build(ccusage): use nix for unix native fallback#1318
ryoppippi wants to merge 5 commits into
mainfrom
codex/use-nix-native-builds

Conversation

@ryoppippi

@ryoppippi ryoppippi commented Jun 14, 2026

Copy link
Copy Markdown
Member

Switches the ccusage native-binary fallback to Nix-backed package builds.

Linux now builds the static flake package, macOS x64 uses the dedicated Darwin x64 package, and macOS arm64 uses the native ccusage package. Unsupported platforms fail when no Nix package mapping exists; Windows native packages are built by the dedicated CI action instead of this prepack script.

Testing:

  • direnv exec . just fmt
  • direnv exec . just test-nu-scripts
  • direnv exec . fish -c "cd apps/ccusage && scripts/ensure-native-binary.nu"
  • git diff --check

Summary by CodeRabbit

  • Chores
    • Improved native binary build workflow by preferring Nix-built binaries on supported Linux/macOS, reusing existing matching outputs when available, and performing stricter version and portability validation.
    • Added clearer failures when expected native build outputs can’t be located or produced.
  • Tests
    • Added Nushell coverage across multiple OS/architecture combinations, including a case where no output is expected.
    • Updated the main test workflow to include these Nushell checks alongside existing suites.
  • Documentation
    • Refined notes describing macOS/Windows build behavior.

Switch ensure-native-binary to build Unix fallback binaries through the flake instead of invoking cargo directly. Linux now uses the static package, Darwin x64 uses the dedicated cross package, and Darwin arm64 uses the native ccusage package.

Keep the Windows fallback on cargo build because the flake does not provide Windows native package builds. Add a focused Nushell test for the platform-to-flake mapping and wire it into the root test aggregate.
@pullfrog

pullfrog Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

@ryoppippi

Copy link
Copy Markdown
Member Author

@coderabbitai review
@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai review
@cubic-dev-ai review

@ryoppippi I have started the AI code review. It will take a few minutes to complete.

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 69e36120-2954-41b1-a9d5-32030777e8d3

📥 Commits

Reviewing files that changed from the base of the PR and between 9749292 and 7ec0d06.

📒 Files selected for processing (1)
  • apps/ccusage/scripts/ensure-native-binary.nu
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/ccusage/scripts/ensure-native-binary.nu

📝 Walkthrough

Walkthrough

ensure-native-binary.nu adds nix_build_attr and build_nix_binary helpers to dispatch builds through Nix on Linux/macOS, removes the precomputed cargo_binary path, integrates the new Nix builder into the main flow with explicit validation, and adds a Nushell test file with justfile wiring to verify the platform-to-attribute mapping.

Changes

Nix-based native binary build flow

Layer / File(s) Summary
nix_build_attr and build_nix_binary helpers with platform documentation
apps/ccusage/scripts/ensure-native-binary.nu, nix/static-package.nix
Adds nix_build_attr to map platform/arch combinations to Nix package attributes (returning null for unsupported platforms), and build_nix_binary to invoke nix build, parse the output path, and return the binary at <out>/bin/<binary_name>. Comment in nix/static-package.nix is updated to document that macOS x64 now targets .#ccusage-darwin-x64 rather than falling back to cargo build.
Main build flow refactoring and build_nix_binary integration
apps/ccusage/scripts/ensure-native-binary.nu
Removes the precomputed cargo_binary release artifact path from the early-exit block, and replaces the post-build check with a dispatch that assigns built_binary via build_nix_binary for Linux/macOS targets, then validates version match and binary portability (Linux must be static; macOS may only link system dylibs) with explicit error messages on failure.
nix_build_attr tests and justfile wiring
apps/ccusage/scripts/ensure-native-binary.test.nu, justfile
Adds a Nushell test file asserting expected nix_build_attr outputs for Linux x64/arm64, macOS x64/arm64, and Windows x64 (including a null case for unsupported platforms). The justfile test recipe is extended to run test-nu-scripts in parallel, which executes the Nushell tests from apps/ccusage/scripts.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • ccusage/ccusage#1256: Establishes the portability-validation gates (static on Linux, system dylibs on macOS) that this PR's new built_binary validation logic enforces.
  • ccusage/ccusage#1289: Adds the ccusage-darwin-x64 Nix package and CI that produces it, which is the exact target consumed by the new nix_build_attr mapping for macOS x64 in this PR.

Suggested reviewers

  • pullfrog

Poem

🐇 Hop, hop through the Nix store I go,
Building binaries in a tidy flake flow,
On Linux and Darwin, nix build takes the lead,
Static and pure, each portable indeed.
With test-nu-scripts, my mapping stands true,
A bunny-approved flow from old to the new! 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'build(ccusage): use nix for unix native fallback' clearly summarizes the main change: replacing the cargo-based fallback with a Nix-based approach for Unix platforms.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/use-nix-native-builds

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

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 14, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
ccusage-guide 7ec0d06 Commit Preview URL

Branch Preview URL
Jun 14 2026, 08:20 PM

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Get PR details
gh pr view 1318 --repo ccusage/ccusage --json title,body,files,additions,deletions,commits

echo "=== PR Files Changed ==="
gh pr diff 1318 --repo ccusage/ccusage

Length of output: 8891



@ryoppippi: Here is the review for PR #1318.

Review: build(ccusage): use nix for unix native fallback

The overall approach is clean — routing Unix builds through the flake, keeping Cargo only for Windows, and adding a portability check for all build paths. A few issues worth addressing:


🐛 Bug: --bin flag hardcoded in build_cargo_binary

def build_cargo_binary [repo_root: path, binary_name: string] {
    ^cargo build --manifest-path ($repo_root | path join rust Cargo.toml) --release --bin ccusage
    #                                                                                    ^^^^^^^
    #  Should be --bin $binary_name — the return path already uses $binary_name
    $repo_root | path join rust target release $binary_name
}

The --bin flag is hardcoded as ccusage while the path returned uses $binary_name. If these ever diverge the build will succeed but the returned path will point to a non-existent binary. Fix:

^cargo build --manifest-path ($repo_root | path join rust Cargo.toml) --release --bin $binary_name

⚠️ Dead null-check after last

let out_path = (
    $result.stdout | lines | where {|line| $line | is-not-empty } | last
)
if $out_path == null {
    error make { msg: $"nix build ($flake_ref) did not print an output path" }
}

In Nushell, calling last on an empty list raises a runtime error rather than returning null, so the null guard is unreachable. Consider replacing with an explicit empty-list check before calling last:

let lines = ($result.stdout | lines | where {|line| $line | is-not-empty })
if ($lines | is-empty) {
    error make { msg: $"nix build ($flake_ref) did not print an output path" }
}
let out_path = ($lines | last)

💡 Minor: run-external vs ^ for consistency

The rest of the script uses ^cargo (the caret-prefix form for external commands). run-external nix build ... works, but ^nix build ... | complete is also valid and keeps the style consistent:

let result = (^nix build $flake_ref '--no-link' '--print-out-paths' '--print-build-logs' | complete)

✅ Positives

  • Portable-binary check is now applied to all build paths (was missing for the old Cargo fallback) — good improvement.
  • Test coverage for nix_build_attr covers all five expected combinations including the null (win32) case.
  • justfile correctly wires test-nu-scripts into the parallel test aggregate.
  • Comment in nix/static-package.nix accurately reflects the updated matrix.

In Nushell, calling `last` on an empty list raises a runtime error
rather than returning null, so the `if $out_path == null` guard was
unreachable. Check the filtered line list with `is-empty` before
calling `last` so the missing-output-path branch can actually fire.

Also swap `run-external nix build` for `^nix build` to match the
`^cargo`, `^ldd`, `^otool` style used elsewhere in this script.

Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
@pkg-pr-new

pkg-pr-new Bot commented Jun 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

ccusage

npx https://pkg.pr.new/ccusage@1318

@ccusage/ccusage-darwin-arm64

npx https://pkg.pr.new/@ccusage/ccusage-darwin-arm64@1318

@ccusage/ccusage-darwin-x64

npx https://pkg.pr.new/@ccusage/ccusage-darwin-x64@1318

@ccusage/ccusage-linux-arm64

npx https://pkg.pr.new/@ccusage/ccusage-linux-arm64@1318

@ccusage/ccusage-linux-x64

npx https://pkg.pr.new/@ccusage/ccusage-linux-x64@1318

@ccusage/ccusage-win32-x64

npx https://pkg.pr.new/@ccusage/ccusage-win32-x64@1318

commit: 7ec0d06

Rename the Cargo fallback path parameter from binary_name to executable_name so it is clear that the value is the platform-specific output filename, not the Cargo bin target.

The Cargo target remains ccusage because Windows output is ccusage.exe while the Cargo bin name does not include the executable suffix.
@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 19215fe19e95
Base SHA: 10e373025e45

This compares the PR package against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 244.8ms 4.11 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 217.7ms 4.62 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 104.0ms 9.68 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 84.9ms 11.86 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 24.4ms 25.4ms 0.96x 53.75 MiB 53.50 MiB 1.00x 0.06 MiB/s 0.06 MiB/s
claude session --offline --json 0.00 MiB 25.8ms 24.8ms 1.04x 53.50 MiB 53.75 MiB 1.00x 0.06 MiB/s 0.06 MiB/s
codex daily --offline --json 0.00 MiB 22.2ms 23.4ms 0.95x 53.50 MiB 53.75 MiB 1.00x 0.04 MiB/s 0.04 MiB/s
codex session --offline --json 0.00 MiB 23.4ms 25.8ms 0.90x 53.75 MiB 53.50 MiB 1.00x 0.04 MiB/s 0.03 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 269.7ms 247.7ms 1.09x 952.34 MiB 970.32 MiB 1.02x 3.73 GiB/s 4.06 GiB/s
codex --offline --json 1.01 GiB 101.0ms 101.8ms 0.99x 415.03 MiB 433.04 MiB 1.04x 9.97 GiB/s 9.89 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 18.08 KiB 18.08 KiB +0.00 KiB 1.00x
installed native package binary 3851.00 KiB 3851.00 KiB +0.00 KiB 1.00x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 19215fe19e95
Base SHA: 10e373025e45

This compares the Rust PR release binary against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 244.8ms 4.11 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 215.4ms 4.67 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 103.4ms 9.74 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 79.1ms 12.72 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 24.0ms 4.2ms 5.74x 53.50 MiB 10.19 MiB 0.19x 0.06 MiB/s 0.37 MiB/s
claude session --offline --json 0.00 MiB 24.4ms 3.4ms 7.18x 53.50 MiB 10.19 MiB 0.19x 0.06 MiB/s 0.46 MiB/s
codex daily --offline --json 0.00 MiB 24.2ms 2.1ms 11.72x 53.75 MiB 8.19 MiB 0.15x 0.04 MiB/s 0.41 MiB/s
codex session --offline --json 0.00 MiB 24.2ms 2.1ms 11.58x 53.75 MiB 8.18 MiB 0.15x 0.04 MiB/s 0.41 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 290.8ms 237.4ms 1.23x 964.33 MiB 914.32 MiB 0.95x 3.46 GiB/s 4.24 GiB/s
codex --offline --json 1.01 GiB 100.9ms 81.2ms 1.24x 411.03 MiB 429.04 MiB 1.04x 9.98 GiB/s 12.41 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 18.08 KiB 18.08 KiB +0.00 KiB 1.00x
installed native package binary 3851.00 KiB 3851.00 KiB +0.00 KiB 1.00x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

Remove the non-Unix Cargo fallback from ensure-native-binary so the script always resolves a configured Nix package before building. Unsupported platforms now fail with the existing missing Nix package error instead of invoking Cargo.

CI builds Windows native packages through the dedicated Windows action, not through this package prepack script.
@ryoppippi

Copy link
Copy Markdown
Member Author

@coderabbitai @cubic-dev-ai Updated the branch after review. The unreachable output-path guard and ^nix style were already addressed in 7f7406f. For the Cargo fallback note: this prepack script should not handle Windows at all, so 9749292 removes the Cargo fallback instead of changing the Cargo target name. Validation: direnv exec . just fmt; direnv exec . just test-nu-scripts; direnv exec . fish -c "cd apps/ccusage && scripts/ensure-native-binary.nu"; git diff --check.

@cubic-dev-ai

cubic-dev-ai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai @cubic-dev-ai Updated the branch after review. The unreachable output-path guard and ^nix style were already addressed in 7f7406f. For the Cargo fallback note: this prepack script should not handle Windows at all, so 9749292 removes the Cargo fallback instead of changing the Cargo target name. Validation: direnv exec . just fmt; direnv exec . just test-nu-scripts; direnv exec . fish -c "cd apps/ccusage && scripts/ensure-native-binary.nu"; git diff --check.

@ryoppippi The three points from the earlier review are all handled now:

  1. Unreachable null check after last — fixed in 7f7406f by adding the is-empty guard before calling last, so that branch can actually fire if Nix doesn't print an output path.

  2. ^nix style — also in 7f7406f, run-external nix build^nix build to match the ^cargo, ^ldd, ^otool convention used elsewhere in the script.

  3. Cargo fallback9749292 removes it entirely rather than renaming the --bin arg. Since Windows native packages are built by the dedicated CI action, this script no longer needs a Cargo escape hatch. Unsupported platforms hit the missing Nix package error, which is the correct behavior.

The diff looks clean and the validation commands you ran (just fmt, just test-nu-scripts, the dry run of ensure-native-binary.nu, and git diff --check) all passed, so no outstanding issues from my side.

Tip: get faster answers by chatting with cubic’s review copilot in the review UI

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Get the latest diff to verify the addressed issues
gh pr diff 1318 --repo ccusage/ccusage

Length of output: 5915



@ryoppippi: All three issues are now resolved — thanks for the thorough follow-up.

  1. Unreachable null-check (7f7406f2) — the is-empty guard before last is exactly right. ✅
  2. ^nix style (7f7406f2) — consistent with ^cargo, ^ldd, ^otool throughout the script. ✅
  3. --bin hardcoding (97492920) — removing build_cargo_binary entirely is the cleaner call; failing fast for unsupported platforms is better than maintaining a Cargo path that was never meant for Windows prepack flows. ✅

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 7f7406f2634e
Base SHA: 10e373025e45

This compares the PR package against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 245.4ms 4.10 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 222.2ms 4.53 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 104.9ms 9.60 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 82.6ms 12.19 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 25.3ms 23.6ms 1.07x 53.75 MiB 53.50 MiB 1.00x 0.06 MiB/s 0.07 MiB/s
claude session --offline --json 0.00 MiB 24.6ms 22.3ms 1.10x 53.75 MiB 53.75 MiB 1.00x 0.06 MiB/s 0.07 MiB/s
codex daily --offline --json 0.00 MiB 23.7ms 22.7ms 1.04x 53.25 MiB 53.75 MiB 1.01x 0.04 MiB/s 0.04 MiB/s
codex session --offline --json 0.00 MiB 22.4ms 23.5ms 0.95x 53.50 MiB 53.50 MiB 1.00x 0.04 MiB/s 0.04 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 268.6ms 253.9ms 1.06x 946.32 MiB 948.33 MiB 1.00x 3.75 GiB/s 3.96 GiB/s
codex --offline --json 1.01 GiB 100.6ms 100.8ms 1.00x 421.04 MiB 427.04 MiB 1.01x 10.01 GiB/s 9.99 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 18.08 KiB 18.08 KiB +0.00 KiB 1.00x
installed native package binary 3851.00 KiB 3851.00 KiB +0.00 KiB 1.00x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 7f7406f2634e
Base SHA: 10e373025e45

This compares the Rust PR release binary against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 258.9ms 3.89 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 223.6ms 4.50 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 106.2ms 9.48 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 86.4ms 11.65 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 27.3ms 4.1ms 6.69x 54.00 MiB 10.19 MiB 0.19x 0.06 MiB/s 0.38 MiB/s
claude session --offline --json 0.00 MiB 26.3ms 3.6ms 7.25x 53.50 MiB 10.19 MiB 0.19x 0.06 MiB/s 0.43 MiB/s
codex daily --offline --json 0.00 MiB 26.0ms 2.2ms 11.88x 53.75 MiB 8.18 MiB 0.15x 0.03 MiB/s 0.39 MiB/s
codex session --offline --json 0.00 MiB 25.8ms 2.2ms 11.65x 53.50 MiB 8.18 MiB 0.15x 0.03 MiB/s 0.39 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 276.5ms 237.1ms 1.17x 926.32 MiB 948.33 MiB 1.02x 3.64 GiB/s 4.25 GiB/s
codex --offline --json 1.01 GiB 102.6ms 106.2ms 0.97x 435.04 MiB 435.04 MiB 1.00x 9.81 GiB/s 9.48 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 18.08 KiB 18.08 KiB +0.00 KiB 1.00x
installed native package binary 3851.00 KiB 3851.00 KiB +0.00 KiB 1.00x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 9749292061bf
Base SHA: 10e373025e45

This compares the PR package against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 249.1ms 4.04 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 223.6ms 4.50 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 120.1ms 8.38 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 98.1ms 10.26 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 22.4ms 26.8ms 0.84x 53.75 MiB 53.50 MiB 1.00x 0.07 MiB/s 0.06 MiB/s
claude session --offline --json 0.00 MiB 24.8ms 22.8ms 1.09x 53.50 MiB 53.50 MiB 1.00x 0.06 MiB/s 0.07 MiB/s
codex daily --offline --json 0.00 MiB 22.9ms 21.7ms 1.05x 54.00 MiB 53.50 MiB 0.99x 0.04 MiB/s 0.04 MiB/s
codex session --offline --json 0.00 MiB 22.2ms 22.3ms 1.00x 53.50 MiB 53.50 MiB 1.00x 0.04 MiB/s 0.04 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 269.8ms 257.7ms 1.05x 922.32 MiB 944.33 MiB 1.02x 3.73 GiB/s 3.91 GiB/s
codex --offline --json 1.01 GiB 99.3ms 104.6ms 0.95x 413.04 MiB 427.04 MiB 1.03x 10.13 GiB/s 9.62 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 18.08 KiB 18.08 KiB +0.00 KiB 1.00x
installed native package binary 3851.00 KiB 3851.00 KiB +0.00 KiB 1.00x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 9749292061bf
Base SHA: 10e373025e45

This compares the Rust PR release binary against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 243.7ms 4.13 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 211.7ms 4.76 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 112.1ms 8.98 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 89.6ms 11.24 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 30.7ms 5.0ms 6.14x 54.00 MiB 10.19 MiB 0.19x 0.05 MiB/s 0.31 MiB/s
claude session --offline --json 0.00 MiB 29.7ms 4.7ms 6.36x 53.75 MiB 10.20 MiB 0.19x 0.05 MiB/s 0.33 MiB/s
codex daily --offline --json 0.00 MiB 30.9ms 2.5ms 12.35x 54.00 MiB 8.18 MiB 0.15x 0.03 MiB/s 0.34 MiB/s
codex session --offline --json 0.00 MiB 28.6ms 2.6ms 11.18x 53.75 MiB 8.18 MiB 0.15x 0.03 MiB/s 0.34 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 278.3ms 226.7ms 1.23x 930.32 MiB 934.32 MiB 1.00x 3.62 GiB/s 4.44 GiB/s
codex --offline --json 1.01 GiB 114.0ms 88.7ms 1.29x 421.04 MiB 399.03 MiB 0.95x 8.83 GiB/s 11.35 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 18.08 KiB 18.08 KiB +0.00 KiB 1.00x
installed native package binary 3851.00 KiB 3851.00 KiB +0.00 KiB 1.00x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

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

⚠️ Outside diff range comments (1)
apps/ccusage/scripts/ensure-native-binary.nu (1)

26-36: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Copy the validated Nix output into the native package before exiting.

build_nix_binary returns a Nix store path, but this branch only validates that path and then ends. $native_package_root/bin/$binary_name is never created or updated, so a supported Unix target with no preexisting package binary still leaves the package payload empty. Fail early when $native_package_root is null, then stage $built_binary into $native_binary.

Proposed fix
     if not (is_portable_binary $target_platform $built_binary) {
         error make {
             msg: $"($built_binary) depends on dynamic libraries that do not exist on end-user machines; rebuild it \(Linux packages must be static, macOS packages may only link system dylibs)"
         }
     }
+    if $native_package_root == null {
+        error make {
+            msg: $"No native package directory matches ($target_platform)-($target_arch)"
+        }
+    }
+    mkdir ($native_package_root | path join bin)
+    cp --force $built_binary $native_binary
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/ccusage/scripts/ensure-native-binary.nu` around lines 26 - 36, After the
validation checks for the built binary in the build_nix_binary function block
(specifically after the is_portable_binary check), add logic to fail early if
$native_package_root is null, then copy the validated $built_binary to
$native_package_root/bin/$binary_name to actually stage the binary into the
native package directory. Currently the code validates the built binary but
never copies it to the destination, leaving the package payload empty.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@apps/ccusage/scripts/ensure-native-binary.nu`:
- Around line 26-36: After the validation checks for the built binary in the
build_nix_binary function block (specifically after the is_portable_binary
check), add logic to fail early if $native_package_root is null, then copy the
validated $built_binary to $native_package_root/bin/$binary_name to actually
stage the binary into the native package directory. Currently the code validates
the built binary but never copies it to the destination, leaving the package
payload empty.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7fe3e4cb-2b40-473c-891e-c86e168d1aff

📥 Commits

Reviewing files that changed from the base of the PR and between 7f7406f and 9749292.

📒 Files selected for processing (1)
  • apps/ccusage/scripts/ensure-native-binary.nu

Copy the validated Nix build output into the matching native package directory when ensure-native-binary has to build a missing or stale Unix native binary.

The package bin directories are ignored generated artifacts, so this preserves clean source control while ensuring local prepack fallback builds produce a package payload.
@ryoppippi

Copy link
Copy Markdown
Member Author

@coderabbitai @cubic-dev-ai Addressed the remaining staging feedback in 7ec0d06 by copying the validated Nix fallback output into the matching native package bin directory. Validation: direnv exec . just fmt; direnv exec . just test-nu-scripts; direnv exec . fish -c "cd apps/ccusage && scripts/ensure-native-binary.nu"; git diff --check.

@cubic-dev-ai

cubic-dev-ai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai @cubic-dev-ai Addressed the remaining staging feedback in 7ec0d06 by copying the validated Nix fallback output into the matching native package bin directory. Validation: direnv exec . just fmt; direnv exec . just test-nu-scripts; direnv exec . fish -c "cd apps/ccusage && scripts/ensure-native-binary.nu"; git diff --check.

@ryoppippi The staging feedback is handled in 7ec0d06. The three new lines you added after the validation checks are exactly right:

  1. mkdir ensures the target bin/ directory exists (it's gitignored, so it won't be there on a fresh checkout)
  2. cp -f $built_binary $native_binary copies the Nix store output into the package directory
  3. chmod 755 $native_binary sets executable permissions since cp preserves the Nix store's read-only mode

This means the package directory will have a real binary even when ensure-native-binary.nu runs as a prepack fallback, not just when CI installs the pre-built package. Clean.

Tip: get faster answers by chatting with cubic’s review copilot in the review UI

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Get the latest diff to verify the addressed issues
gh pr diff 1318 --repo ccusage/ccusage

echo "=== Commit 7ec0d06b details ==="
gh api repos/ccusage/ccusage/commits/7ec0d06b

Length of output: 12423



@ryoppippi: Commit 7ec0d06b looks correct. The staging sequence is well-ordered:

  1. null guard on $native_package_root — valid safety net for the case where a Nix-supported platform has no matching package directory on disk (unreachable via build_nix_binary's own null-attr guard, but good defensive depth). ✅
  2. mkdir ($native_package_root | path join bin) — ensures the bin directory exists before copying. ✅
  3. cp -f $built_binary $native_binary — stages the version-verified, portability-checked binary with force-overwrite. ✅
  4. chmod 755 $native_binary — ensures the binary is executable after copy. ✅

The staging step comes after both the version check and the portability check, so only binaries that have passed all validation gates are written into the package payload. Nothing left to flag here.

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 7ec0d06b6364
Base SHA: 10e373025e45

This compares the Rust PR release binary against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 251.6ms 4.00 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 225.8ms 4.46 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 104.0ms 9.68 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 98.1ms 10.27 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 27.2ms 4.3ms 6.29x 53.50 MiB 10.20 MiB 0.19x 0.06 MiB/s 0.36 MiB/s
claude session --offline --json 0.00 MiB 25.0ms 2.7ms 9.12x 54.00 MiB 10.20 MiB 0.19x 0.06 MiB/s 0.56 MiB/s
codex daily --offline --json 0.00 MiB 24.1ms 2.2ms 11.16x 53.75 MiB 8.18 MiB 0.15x 0.04 MiB/s 0.40 MiB/s
codex session --offline --json 0.00 MiB 22.3ms 2.1ms 10.49x 53.50 MiB 8.18 MiB 0.15x 0.04 MiB/s 0.40 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 284.7ms 234.9ms 1.21x 954.33 MiB 948.32 MiB 0.99x 3.54 GiB/s 4.29 GiB/s
codex --offline --json 1.01 GiB 102.4ms 85.2ms 1.20x 443.04 MiB 425.03 MiB 0.96x 9.83 GiB/s 11.82 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 18.08 KiB 18.08 KiB +0.00 KiB 1.00x
installed native package binary 3851.00 KiB 3851.00 KiB +0.00 KiB 1.00x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 7ec0d06b6364
Base SHA: 10e373025e45

This compares the PR package against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 238.4ms 4.22 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 220.7ms 4.56 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 101.5ms 9.92 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 83.2ms 12.11 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 24.3ms 22.7ms 1.07x 53.75 MiB 53.50 MiB 1.00x 0.06 MiB/s 0.07 MiB/s
claude session --offline --json 0.00 MiB 22.5ms 23.4ms 0.96x 53.50 MiB 53.75 MiB 1.00x 0.07 MiB/s 0.07 MiB/s
codex daily --offline --json 0.00 MiB 22.4ms 23.5ms 0.95x 53.50 MiB 53.75 MiB 1.00x 0.04 MiB/s 0.04 MiB/s
codex session --offline --json 0.00 MiB 22.6ms 22.8ms 0.99x 53.50 MiB 53.75 MiB 1.00x 0.04 MiB/s 0.04 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 258.2ms 251.6ms 1.03x 960.33 MiB 944.33 MiB 0.98x 3.90 GiB/s 4.00 GiB/s
codex --offline --json 1.01 GiB 97.0ms 101.1ms 0.96x 425.02 MiB 429.04 MiB 1.01x 10.38 GiB/s 9.95 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 18.08 KiB 18.08 KiB +0.00 KiB 1.00x
installed native package binary 3851.00 KiB 3851.00 KiB +0.00 KiB 1.00x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

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