-
Notifications
You must be signed in to change notification settings - Fork 3
#263: reduce execution time for test test_shrink_cache_if_more_then_10_mb
#273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughTests in test/fbe/middleware/test_sqlite_store.rb were modified to change key/value sizes and iteration counts, updating boundary conditions for write-skipping and cache-shrinking behavior. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
test/fbe/middleware/test_sqlite_store.rb (1)
165-165: Consider reducing the key size for better test readability.While the 65,536-character key works for performance, it may make debugging more difficult if the test fails. Consider using a more reasonable key size (e.g., 1,024 characters) that still achieves the performance goals.
- key = 'a' * 65_536 + key = 'a' * 1_024You may need to adjust the iteration count slightly to maintain the ~10MB target file size.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
test/fbe/middleware/test_sqlite_store.rb(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: Yegorov
PR: zerocracy/fbe#247
File: lib/fbe/middleware/sqlite_store.rb:112-115
Timestamp: 2025-07-10T20:11:32.197Z
Learning: In HTTP response caches like Fbe::Middleware::SqliteStore, updating the created_at timestamp on conflict (when overwriting an existing cache key) is the preferred behavior because fresh data should get a fresh TTL. This aligns with standard cache semantics where new values effectively represent new cache entries.
🔇 Additional comments (1)
test/fbe/middleware/test_sqlite_store.rb (1)
165-170: Performance optimization achieved through strategic data sizing.The changes successfully reduce test execution time by:
- Using a very large key (65,536 characters) instead of a short one
- Increasing value size from ~2KB to ~8KB
- Dramatically reducing iterations from 10,240 to 52
This maintains the same total data volume (~10MB) while significantly reducing the number of database operations, which is the primary performance bottleneck.
|
@yegor256 please check |
|
@Yegorov cool, thanks! |
|
@Yegorov Hey there! 👋 Nice work on your contribution! You've earned +4 points for this one. Here's the breakdown: +16 for showing up, -16 because we missed the code review (let's fix that next time!), and -8 because we're aiming for at least 20 hits-of-code (you had 6). We bumped you up +12 to keep you motivated. Remember, more code and reviews can boost your points even higher! Your total is now +71. Keep the code flowing, and don't forget to check your Zerocracy balance! |
Before
After
Closes #263
Summary by CodeRabbit