

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
123456# Rails Performance Guide78## Core Philosophy910- Measure before optimizing11- Optimize for the common case12- Keep solutions simple and maintainable13- Use Rails built-in performance features14- Monitor performance in production1516## Database Optimization Principles1718- Design efficient schemas from the start19- Index foreign keys and queried columns20- Use database-specific features wisely21- Keep queries simple and focused22- Monitor slow query logs2324## Query Optimization2526- Eliminate N+1 queries with includes27- Use select to limit returned columns28- Implement pagination for large datasets29- Use pluck for single column queries30- Batch process large operations3132## Indexing Strategy3334- Index all foreign keys35- Create composite indexes for multi-column queries36- Use partial indexes for filtered queries37- Monitor index usage and effectiveness38- Remove unused indexes3940## Caching Principles4142- Cache at multiple levels43- Use Russian doll caching for nested content44- Implement fragment caching for expensive views45- Cache database queries appropriately46- Monitor cache hit rates4748## Rails Cache Store4950- Use Solid Cache for database-backed caching51- Configure Redis for high-traffic applications52- Set appropriate cache expiration53- Use cache keys that auto-expire54- Monitor cache memory usage5556## Fragment Caching5758- Cache expensive view partials59- Use cache digests for automatic expiration60- Implement conditional caching61- Cache user-specific content carefully62- Profile view rendering times6364## Query Caching6566- Leverage Rails query cache67- Use low-level caching for expensive calculations68- Cache aggregated data69- Implement counter caches70- Update caches strategically7172## Asset Optimization7374- Use Propshaft for simple asset handling75- Implement CDN for asset delivery76- Compress assets appropriately77- Set proper cache headers78- Optimize image sizes7980## Background Job Performance8182- Process heavy operations asynchronously83- Use appropriate queue priorities84- Batch similar operations85- Monitor job queue depth86- Implement job timeouts8788## Memory Management8990- Profile memory usage regularly91- Fix memory leaks promptly92- Use streaming for large responses93- Implement pagination everywhere94- Monitor memory trends9596## Database Connection Pooling9798- Configure connection pool appropriately99- Monitor connection usage100- Use read replicas for scaling101- Implement connection timeouts102- Handle connection failures gracefully103104## Eager Loading105106- Use includes for associations107- Implement preload for separate queries108- Use joins for filtering109- Avoid loading unnecessary data110- Profile association loading111112## SQL Optimization113114- Use EXPLAIN to analyze queries115- Optimize slow queries first116- Use database views for complex queries117- Implement materialized views when needed118- Keep queries readable119120## Pagination Best Practices121122- Always paginate large datasets123- Use cursor-based pagination for APIs124- Implement infinite scroll carefully125- Cache pagination counts126- Optimize count queries127128## Caching Strategies129130- Cache computed values131- Use memoization for instance methods132- Implement HTTP caching headers133- Cache external API responses134- Invalidate caches intelligently135136## Performance Monitoring137138- Use APM tools in production139- Monitor response times140- Track database query times141- Alert on performance degradation142- Profile regularly143144## Load Testing145146- Test with realistic data volumes147- Simulate concurrent users148- Identify bottlenecks early149- Test cache effectiveness150- Monitor resource usage151152## Code Optimization153154- Keep methods small and focused155- Avoid unnecessary object allocations156- Use efficient algorithms157- Profile hot code paths158- Optimize critical sections only159160## View Performance161162- Minimize database queries in views163- Use streaming for large responses164- Implement lazy loading165- Optimize partial rendering166- Cache complex calculations167168## API Performance169170- Implement response pagination171- Use sparse fieldsets172- Cache API responses173- Compress responses174- Monitor API usage175176## Database Maintenance177178- Run VACUUM regularly (PostgreSQL)179- Update table statistics180- Monitor table bloat181- Archive old data182- Plan capacity ahead183184## Scaling Strategies185186- Start with vertical scaling187- Implement read replicas188- Use database partitioning189- Consider caching layers190- Plan for horizontal scaling191192## Common Bottlenecks193194- N+1 queries195- Missing indexes196- Large result sets197- Inefficient algorithms198- Memory leaks199200## Performance Tools201202- Use Bullet gem for N+1 detection203- Implement rack-mini-profiler204- Use database query analyzers205- Monitor with New Relic or similar206- Profile with Ruby profilers207208## Development Practices209210- Test with production-like data211- Profile during development212- Review queries in pull requests213- Monitor performance trends214- Document performance decisions215216## Performance Checklist217218- [ ] All foreign keys indexed219- [ ] N+1 queries eliminated220- [ ] Pagination implemented221- [ ] Caching strategy defined222- [ ] Slow queries optimized223- [ ] Memory usage monitored224- [ ] Response times acceptable225- [ ] Background jobs efficient226- [ ] Assets optimized227- [ ] Monitoring in place228229## Best Practices Summary230231- Measure before optimizing232- Fix biggest bottlenecks first233- Use Rails built-in features234- Monitor production performance235- Keep optimizations simple236237Remember: Premature optimization is the root of all evil. Profile first, optimize what matters, and keep solutions maintainable.238
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| levifig/rails-instructions.github/instructions/rails-controllers.instructions.md · 54 | Copilot instructions | teststylesecurityapi+1 | 56/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-models.instructions.md · 54 | Copilot instructions | teststylearchtypes+4 | 60/100 | 14 days ago | |
| levifig/rails-instructions.cursor/rules/rails-rules.mdc · 54 | Cursor rules | testlint-formatstylearch+9 | 84/100 | 14 days ago | |
| levifig/rails-instructions.github/copilot-instructions.md · 54 | Copilot instructions | teststyletesting-strategysecurity+4 | 71/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-api.instructions.md · 54 | Copilot instructions | testlint-formatstyletesting-strategy+7 | 67/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-services.instructions.md · 54 | Copilot instructions | teststylearchtesting-strategy+4 | 75/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-background-jobs.instructions.md · 54 | Copilot instructions | teststyletesting-strategydatabase+2 | 63/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-core.instructions.md · 54 | Copilot instructions | teststylearchtesting-strategy+5 | 68/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-deployment.instructions.md · 54 | Copilot instructions | setupstylesecuritydatabase+2 | 52/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-hotwire.instructions.md · 54 | Copilot instructions | teststylesecurityperformance+1 | 56/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-importmaps.instructions.md · 54 | Copilot instructions | teststylesecuritydatabase+2 | 56/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-mobile.instructions.md · 54 | Copilot instructions | styleuiperformance | 66/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-security.instructions.md · 54 | Copilot instructions | teststylesecuritydependencies+3 | 63/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-styling.instructions.md · 54 | Copilot instructions | styledatabaseuiperformance+3 | 59/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-testing.instructions.md · 54 | Copilot instructions | teststyletesting-strategysecurity+2 | 56/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails-views.instructions.md · 54 | Copilot instructions | teststylearchsecurity+3 | 60/100 | 14 days ago | |
| levifig/rails-instructions.github/instructions/rails.instructions.md · 54 | Copilot instructions | testlint-formatstylearch+9 | 84/100 | 14 days ago | |
| levifig/rails-instructions.cursor/rules/guidelines.mdc · 54 | Cursor rules | teststyletesting-strategysecurity+4 | 71/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/levifig-rails-instructions-github-instructions-rails-performance-instructions)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.