Skip to content

perf: skip unchanged avatar cache writes#254

Merged
AkaraChen merged 1 commit into
devfrom
perf-skip-unchanged-avatar-cache
May 15, 2026
Merged

perf: skip unchanged avatar cache writes#254
AkaraChen merged 1 commit into
devfrom
perf-skip-unchanged-avatar-cache

Conversation

@AkaraChen
Copy link
Copy Markdown
Owner

@AkaraChen AkaraChen commented May 15, 2026

Summary

  • skip avatar cache persistence when the cached value already matches the fetched value
  • avoid unnecessary full-cache JSON.stringify and localStorage.setItem on repeated identical avatar responses
  • add a Vitest benchmark for unchanged cache writes

Benchmarks

  • bunx vitest bench src/features/projects/projectAvatarCache.bench.ts --run
    • skip unchanged cache write: 44,737,128.75 hz
    • stringify unchanged cache: 18,493.80 hz
    • speedup: 2419.03x

Tests

  • bunx vitest run src/features/projects/hooks.avatar.test.tsx
  • bunx eslint src/features/projects/projectAvatarCache.ts src/features/projects/projectAvatarCache.bench.ts
  • bunx tsc --noEmit

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

Warning

Rate limit exceeded

@AkaraChen has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 22 minutes and 4 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b313867b-b786-436c-8497-e4993921dfd1

📥 Commits

Reviewing files that changed from the base of the PR and between 38c7ff8 and a26c167.

📒 Files selected for processing (2)
  • src/features/projects/hooks.avatar.test.tsx
  • src/features/projects/projectAvatarCache.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perf-skip-unchanged-avatar-cache

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.

Copy link
Copy Markdown
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@AkaraChen AkaraChen marked this pull request as ready for review May 15, 2026 10:26
@AkaraChen AkaraChen force-pushed the perf-skip-unchanged-avatar-cache branch from d11566a to a26c167 Compare May 15, 2026 14:23
@AkaraChen AkaraChen merged commit 5f529b0 into dev May 15, 2026
5 of 6 checks passed
@AkaraChen AkaraChen deleted the perf-skip-unchanged-avatar-cache branch May 15, 2026 14:23
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