refactor(adapter): move Codex loader under adapters by ryoppippi · Pull Request #1131 · ccusage/ccusage · GitHub
Skip to content

refactor(adapter): move Codex loader under adapters#1131

Merged
ryoppippi merged 2 commits into
mainfrom
refactor/codex-adapter-layout
May 23, 2026
Merged

refactor(adapter): move Codex loader under adapters#1131
ryoppippi merged 2 commits into
mainfrom
refactor/codex-adapter-layout

Conversation

@ryoppippi

@ryoppippi ryoppippi commented May 23, 2026

Copy link
Copy Markdown
Member

Move the Codex loader into the Codex adapter subtree so source-specific runtime logic lives under src/adapter/codex alongside command/report wiring.

This mirrors the Claude adapter layout by converting adapter/codex.rs to adapter/codex/mod.rs, moving codex_loader.rs to adapter/codex/loader.rs, and updating internal call sites to use the adapter surface.

Testing:

  • direnv exec . cargo test --manifest-path rust/Cargo.toml -p ccusage codex -- --nocapture
  • direnv exec . pnpm run format
  • direnv exec . pnpm typecheck
  • direnv exec . pnpm run test
  • pre-push hook: typos, oxfmt, gitleaks, cargo test, clippy

@coderabbitai review


Summary by cubic

Moved the Codex loader under src/adapter/codex to keep runtime logic with the adapter and mirror the Claude adapter layout. No behavior changes; imports, tests, and the insta snapshot path were updated.

  • Refactors
    • Moved codex_loader to adapter/codex/loader.rs and split adapter/codex.rs into adapter/codex/mod.rs.
    • Updated call sites to use adapter::codex::load_codex_events; internal callers use loader::*.
    • Removed root-level codex_loader exports and module; tests call adapter::codex::load_codex_events_from_directory.
    • Relocated snapshot to adapter/codex/snapshots and updated its source to adapter/codex/mod.rs.

Written for commit a93310d. Summary will update on new commits. Review in cubic

Summary by CodeRabbit

  • Refactor
    • Reorganized internal code structure for improved modularity of Codex event processing. Updated internal function calls to use the newly organized module structure.

Review Change Stack

Move the Codex loader from the crate root into the Codex adapter module so the runtime source-specific logic lives under src/adapter/codex.

This mirrors the Claude adapter layout, removes the root-level codex_loader module, and updates all internal callers to use the Codex adapter surface. The snapshot file moves with the adapter module so insta keeps the same expected output under the new source path.
@coderabbitai

coderabbitai Bot commented May 23, 2026

Copy link
Copy Markdown

@ryoppippi

Copy link
Copy Markdown
Member Author

@coderabbitai review

Pushed commit `65fc9e9` for the Codex adapter layout move. Please review this PR.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 23, 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 a93310d Commit Preview URL

Branch Preview URL
May 23 2026, 02:53 PM

@coderabbitai

coderabbitai Bot commented May 23, 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 PR diff
gh pr view 1131 --repo ryoppippi/ccusage --json files,title,body,commits

# Get changed files
gh pr diff 1131 --repo ryoppippi/ccusage

Length of output: 8198


🏁 Script executed:

#!/bin/bash
# Check for any remaining stale references to old paths
rg -n "codex_loader|crate::load_codex_events|crate::codex_usage_paths|crate::visit_codex_session_file" rust/

# Verify the snapshot filename matches the new module path
cat "rust/crates/ccusage/src/adapter/codex/snapshots/ccusage__adapter__codex__tests__snapshots_codex_reports_for_periods_sessions_costs_and_fallback_models.snap" | head -10

# Check the claude adapter layout for structural comparison
tree rust/crates/ccusage/src/adapter/ 2>/dev/null || find rust/crates/ccusage/src/adapter/ -type f | sort

Length of output: 1526


@ryoppippi This is a clean, well-executed structural refactoring. Here's the full review:


Review Summary ✅

No functional changes — pure module reorganization.

What was verified

Check Result
Stale crate::load_codex_events / crate::codex_usage_paths / crate::visit_codex_session_file references ✅ None found
Stale codex_loader module references ✅ None found
All 3 internal mod.rs call sites updated to loader:: prefix
All 3 main.rs test call sites updated to adapter::codex::
load_codex_events_from_directory gated under #[cfg(test)] ✅ Appropriate
codex_usage_paths / visit_codex_session_file no longer leaked at crate root ✅ Correct encapsulation
Directory layout mirrors opencode adapter pattern mod.rs + loader.rs + snapshots/

Minor observation (non-blocking)

The relocated snapshot file has a stale source: metadata field:

source: crates/ccusage/src/adapter/codex.rs

It should now reflect crates/ccusage/src/adapter/codex/mod.rs. This is purely cosmetic — insta records this at snapshot-generation time and it doesn't affect test correctness. It will self-correct the next time the snapshot is regenerated via cargo insta review.


The PR achieves its goal perfectly. No issues.

[approve]

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 5 files

Re-trigger cubic

Update the insta snapshot metadata to point at adapter/codex/mod.rs after moving the Codex adapter module.

This addresses the non-blocking CodeRabbit observation and keeps the stored snapshot aligned with the new module path.
@ryoppippi

Copy link
Copy Markdown
Member Author

@coderabbitai review

Pushed commit `a93310d` to update the moved Codex snapshot metadata after your non-blocking observation. Please review the latest change.

@coderabbitai

coderabbitai Bot commented May 23, 2026

Copy link
Copy Markdown

Tip

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the snapshot file metadata after the fix
find rust/crates/ccusage/src/adapter/codex -name "*.snap" | sort

# Show the header of the snapshot file
find rust/crates/ccusage/src/adapter/codex -name "*.snap" -exec head -10 {} \;

Length of output: 864


@ryoppippi The snapshot metadata is now correct — source: crates/ccusage/src/adapter/codex/mod.rs ✅. The fix precisely addresses the observation. All good!

(ノ◕ヮ◕)ノ*:・゚✧

[approve]

@pkg-pr-new

pkg-pr-new Bot commented May 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

ccusage

npx https://pkg.pr.new/ryoppippi/ccusage@1131

@ccusage/ccusage-darwin-arm64

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

@ccusage/ccusage-darwin-x64

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

@ccusage/ccusage-linux-arm64

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

@ccusage/ccusage-linux-x64

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

@ccusage/ccusage-win32-arm64

npx https://pkg.pr.new/ryoppippi/ccusage/@ccusage/ccusage-win32-arm64@1131

@ccusage/ccusage-win32-x64

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

commit: 65fc9e9

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 65fc9e99f0ff
Base SHA: bd6c3dda680e

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

Package runner startup

Execution setup measures any pre-benchmark package materialization used by the execution benchmark. Bunx temp cache measures one bunx -p <url> ccusage --version run with an empty Bun install cache. Warm reuses that cache and reports the median of repeated runs.

Package SHA Execution setup Bunx temp cache Bunx warm median Warm samples
Base pkg.pr.new bd6c3dda680e 509.1ms 487.6ms 34.1ms 3
PR pkg.pr.new 65fc9e99f0ff 437.7ms 477.9ms 32.4ms 3

Cached bunx execution performance

Runs the same large fixture through bunx -p <pkg.pr.new URL> ccusage after the Bun install cache has already been populated by the startup measurement. This separates cached package-runner execution from first-fetch package materialization.

Fixtures: Claude /home/runner/work/_temp/ccusage-large-fixture (1.01 GiB, 2,597 files), Codex /home/runner/work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
Base package: bd6c3dda680e; PR package: 65fc9e99f0ff. Both run through bunx -p <pkg.pr.new URL> ccusage using the warmed Bun install cache from package runner startup, measured by hyperfine with 0 warmups and 1 runs.

Command Input Base median PR median PR vs base Base throughput PR throughput
bunx -p <pkg> ccusage claude --offline --json 1.01 GiB 502.7ms 508.4ms 0.99x 2.00 GiB/s 1.98 GiB/s
bunx -p <pkg> ccusage codex --offline --json 1.01 GiB 356.6ms 358.7ms 0.99x 2.82 GiB/s 2.81 GiB/s

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, 2,597 files), Codex /home/runner/work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 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 495.7ms 2.03 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 457.5ms 2.20 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 351.6ms 2.86 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 334.0ms 3.01 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 rust/target/release/ccusage directly. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.

Command Input Base median PR median PR vs base Base throughput PR throughput
claude daily --offline --json 0.00 MiB 30.8ms 4.4ms 6.91x 0.05 MiB/s 0.35 MiB/s
claude session --offline --json 0.00 MiB 30.2ms 4.4ms 6.82x 0.05 MiB/s 0.35 MiB/s
codex daily --offline --json 0.00 MiB 30.5ms 4.1ms 7.39x 0.03 MiB/s 0.21 MiB/s
codex session --offline --json 0.00 MiB 30.6ms 4.2ms 7.24x 0.03 MiB/s 0.20 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, 2,597 files), Codex /home/runner/work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs rust/target/release/ccusage directly. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.

Command Input Base median PR median PR vs base Base throughput PR throughput
claude --offline --json 1.01 GiB 492.9ms 466.9ms 1.06x 2.04 GiB/s 2.16 GiB/s
codex --offline --json 1.01 GiB 362.9ms 336.0ms 1.08x 2.77 GiB/s 3.00 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 14.25 KiB 14.25 KiB +0.00 KiB 1.00x
installed native package binary 3353.49 KiB 3353.49 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: 65fc9e99f0ff
Base SHA: bd6c3dda680e

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

Package runner startup

Execution setup measures any pre-benchmark package materialization used by the execution benchmark. Bunx temp cache measures one bunx -p <url> ccusage --version run with an empty Bun install cache. Warm reuses that cache and reports the median of repeated runs.

Package SHA Execution setup Bunx temp cache Bunx warm median Warm samples
Base pkg.pr.new bd6c3dda680e 815.1ms 634.7ms 32.9ms 3
PR pkg.pr.new 65fc9e99f0ff 722.9ms 480.6ms 33.0ms 3

Cached bunx execution performance

Runs the same large fixture through bunx -p <pkg.pr.new URL> ccusage after the Bun install cache has already been populated by the startup measurement. This separates cached package-runner execution from first-fetch package materialization.

Fixtures: Claude /home/runner/work/_temp/ccusage-large-fixture (1.01 GiB, 2,597 files), Codex /home/runner/work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
Base package: bd6c3dda680e; PR package: 65fc9e99f0ff. Both run through bunx -p <pkg.pr.new URL> ccusage using the warmed Bun install cache from package runner startup, measured by hyperfine with 0 warmups and 1 runs.

Command Input Base median PR median PR vs base Base throughput PR throughput
bunx -p <pkg> ccusage claude --offline --json 1.01 GiB 502.7ms 498.8ms 1.01x 2.00 GiB/s 2.02 GiB/s
bunx -p <pkg> ccusage codex --offline --json 1.01 GiB 366.7ms 377.8ms 0.97x 2.75 GiB/s 2.66 GiB/s

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, 2,597 files), Codex /home/runner/work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 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 492.9ms 2.04 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 462.7ms 2.18 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 370.3ms 2.72 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 328.0ms 3.07 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.

Command Input Base median PR median PR vs base Base throughput PR throughput
claude daily --offline --json 0.00 MiB 31.8ms 32.4ms 0.98x 0.05 MiB/s 0.05 MiB/s
claude session --offline --json 0.00 MiB 36.1ms 36.7ms 0.98x 0.04 MiB/s 0.04 MiB/s
codex daily --offline --json 0.00 MiB 34.9ms 31.4ms 1.11x 0.02 MiB/s 0.03 MiB/s
codex session --offline --json 0.00 MiB 31.3ms 31.1ms 1.01x 0.03 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, 2,597 files), Codex /home/runner/work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 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.

Command Input Base median PR median PR vs base Base throughput PR throughput
claude --offline --json 1.01 GiB 510.6ms 489.1ms 1.04x 1.97 GiB/s 2.06 GiB/s
codex --offline --json 1.01 GiB 414.1ms 363.1ms 1.14x 2.43 GiB/s 2.77 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 14.25 KiB 14.25 KiB +0.00 KiB 1.00x
installed native package binary 3353.49 KiB 3353.49 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.

@ryoppippi ryoppippi merged commit aa8e101 into main May 23, 2026
29 checks passed
@ryoppippi ryoppippi deleted the refactor/codex-adapter-layout branch May 23, 2026 15:00
@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: a93310d9855e
Base SHA: bd6c3dda680e

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

Package runner startup

Execution setup measures any pre-benchmark package materialization used by the execution benchmark. Bunx temp cache measures one bunx -p <url> ccusage --version run with an empty Bun install cache. Warm reuses that cache and reports the median of repeated runs.

Package SHA Execution setup Bunx temp cache Bunx warm median Warm samples
Base pkg.pr.new bd6c3dda680e 795.4ms 677.0ms 35.5ms 3
PR pkg.pr.new a93310d9855e 589.8ms 551.2ms 36.3ms 3

Cached bunx execution performance

Runs the same large fixture through bunx -p <pkg.pr.new URL> ccusage after the Bun install cache has already been populated by the startup measurement. This separates cached package-runner execution from first-fetch package materialization.

Fixtures: Claude /home/runner/work/_temp/ccusage-large-fixture (1.01 GiB, 2,597 files), Codex /home/runner/work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
Base package: bd6c3dda680e; PR package: a93310d9855e. Both run through bunx -p <pkg.pr.new URL> ccusage using the warmed Bun install cache from package runner startup, measured by hyperfine with 0 warmups and 1 runs.

Command Input Base median PR median PR vs base Base throughput PR throughput
bunx -p <pkg> ccusage claude --offline --json 1.01 GiB 507.5ms 517.4ms 0.98x 1.98 GiB/s 1.95 GiB/s
bunx -p <pkg> ccusage codex --offline --json 1.01 GiB 365.9ms 368.6ms 0.99x 2.75 GiB/s 2.73 GiB/s

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, 2,597 files), Codex /home/runner/work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 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 502.1ms 2.01 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 479.9ms 2.10 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 363.4ms 2.77 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 337.1ms 2.99 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 rust/target/release/ccusage directly. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.

Command Input Base median PR median PR vs base Base throughput PR throughput
claude daily --offline --json 0.00 MiB 32.3ms 4.8ms 6.77x 0.05 MiB/s 0.32 MiB/s
claude session --offline --json 0.00 MiB 32.3ms 4.8ms 6.68x 0.05 MiB/s 0.32 MiB/s
codex daily --offline --json 0.00 MiB 31.7ms 4.5ms 7.07x 0.03 MiB/s 0.19 MiB/s
codex session --offline --json 0.00 MiB 31.9ms 4.5ms 7.02x 0.03 MiB/s 0.19 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, 2,597 files), Codex /home/runner/work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs rust/target/release/ccusage directly. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.

Command Input Base median PR median PR vs base Base throughput PR throughput
claude --offline --json 1.01 GiB 504.0ms 477.1ms 1.06x 2.00 GiB/s 2.11 GiB/s
codex --offline --json 1.01 GiB 358.1ms 334.5ms 1.07x 2.81 GiB/s 3.01 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 14.25 KiB 14.25 KiB +0.00 KiB 1.00x
installed native package binary 3353.49 KiB 3353.49 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: a93310d9855e
Base SHA: bd6c3dda680e

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

Package runner startup

Execution setup measures any pre-benchmark package materialization used by the execution benchmark. Bunx temp cache measures one bunx -p <url> ccusage --version run with an empty Bun install cache. Warm reuses that cache and reports the median of repeated runs.

Package SHA Execution setup Bunx temp cache Bunx warm median Warm samples
Base pkg.pr.new bd6c3dda680e 862.6ms 1.032s 32.4ms 3
PR pkg.pr.new a93310d9855e 827.5ms 976.7ms 33.0ms 3

Cached bunx execution performance

Runs the same large fixture through bunx -p <pkg.pr.new URL> ccusage after the Bun install cache has already been populated by the startup measurement. This separates cached package-runner execution from first-fetch package materialization.

Fixtures: Claude /home/runner/work/_temp/ccusage-large-fixture (1.01 GiB, 2,597 files), Codex /home/runner/work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
Base package: bd6c3dda680e; PR package: a93310d9855e. Both run through bunx -p <pkg.pr.new URL> ccusage using the warmed Bun install cache from package runner startup, measured by hyperfine with 0 warmups and 1 runs.

Command Input Base median PR median PR vs base Base throughput PR throughput
bunx -p <pkg> ccusage claude --offline --json 1.01 GiB 503.5ms 502.9ms 1.00x 2.00 GiB/s 2.00 GiB/s
bunx -p <pkg> ccusage codex --offline --json 1.01 GiB 363.1ms 364.2ms 1.00x 2.77 GiB/s 2.76 GiB/s

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, 2,597 files), Codex /home/runner/work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 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 488.9ms 2.06 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 467.5ms 2.15 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 360.6ms 2.79 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 335.2ms 3.00 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.

Command Input Base median PR median PR vs base Base throughput PR throughput
claude daily --offline --json 0.00 MiB 30.1ms 30.4ms 0.99x 0.05 MiB/s 0.05 MiB/s
claude session --offline --json 0.00 MiB 30.6ms 30.6ms 1.00x 0.05 MiB/s 0.05 MiB/s
codex daily --offline --json 0.00 MiB 30.3ms 30.8ms 0.98x 0.03 MiB/s 0.03 MiB/s
codex session --offline --json 0.00 MiB 29.8ms 30.3ms 0.98x 0.03 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, 2,597 files), Codex /home/runner/work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 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.

Command Input Base median PR median PR vs base Base throughput PR throughput
claude --offline --json 1.01 GiB 492.9ms 493.3ms 1.00x 2.04 GiB/s 2.04 GiB/s
codex --offline --json 1.01 GiB 350.2ms 355.1ms 0.99x 2.87 GiB/s 2.83 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 14.25 KiB 14.25 KiB +0.00 KiB 1.00x
installed native package binary 3353.49 KiB 3353.49 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