PromptsVault AI is thinking...
Searching the best prompts from our community
Searching the best prompts from our community
Prompts matching the #performance tag
Analyze and optimize PostgreSQL query performance. Steps: 1. Identify slow queries with pg_stat_statements. 2. Analyze Execution plans (EXPLAIN ANALYZE). 3. Create covering indexes for frequent queries. 4. Optimize JOIN operations. 5. Vacuum and analyze strategy. 6. Partition large tables. 7. Tune configuration parameters (work_mem, shared_buffers). 8. Connection pooling setup (PgBouncer). Include index maintenance plan.
Optimize React Native app performance. Checklist: 1. Analyze bundle size and startup time. 2. Implement FlatList optimizations (windowSize, initialNumToRender). 3. Memoize heavy computations with useMemo/useCallback. 4. Optimize image loading and caching. 5. Remove unnecessary re-renders using React.memo. 6. Offload complex logic to native modules. 7. Monitor frame drops (FPS) with Perf Monitor. 8. Profile memory usage and fix leaks. Include interaction to next paint (INP) improvements.
Optimize application performance systematically. Techniques: 1. Profile first (identify bottlenecks with profiler). 2. Database optimization (indexes, query optimization, connection pooling). 3. Caching (Redis, Memcached, CDN). 4. Lazy loading (load data on demand). 5. Code-level optimization (efficient algorithms, avoid premature optimization). 6. Asynchronous processing (queues, background jobs). 7. Minification and compression (gzip, Brotli). Frontend: bundle splitting, image optimization, tree shaking. Backend: horizontal scaling, load balancing. Measure impact (before/after metrics). Use APM tools (New Relic, Datadog). 80/20 rule: optimize the 20% causing 80% slowness.
Create a resumable PWA using Qwik's unique architecture. Requirements: 1. Instant interactivity with 0 hydration. 2. Service worker for offline capability. 3. Lazy-load components on interaction. 4. Streaming SSR with early hints. 5. Smart prefetching based on viewport. 6. App shell pattern for navigation. 7. Push notifications integration. 8. Install prompt with custom UI. Use Qwik City for routing and resumability for instant TTI even on slow networks.
Profile and optimize performance. Tools: 1. Chrome DevTools (Performance, Lighthouse). 2. React DevTools Profiler. 3. Node.js --prof and clinic.js. 4. Bundle analysis (webpack-bundle-analyzer). 5. Database query analysis (EXPLAIN). 6. APM tools (New Relic, DataDog). Focus on: render performance, bundle size, API latency, memory usage. Measure before optimizing. Profile in production-like environments.
I have a computationally expensive task in my web app that is blocking the main UI thread. Show me how to offload this task to a Web Worker. Provide the code for the main script that creates the worker and the code for the worker script itself (`worker.js`) that performs the calculation and sends the result back.
Analyze the time complexity (Big O notation) of the following Python function, which checks if an array contains duplicate values. Explain your reasoning step-by-step. `def has_duplicates(arr): for i in range(len(arr)): for j in range(i + 1, len(arr)): if arr[i] == arr[j]: return True; return False`
What is WebAssembly (WASM)? Explain its purpose and how it works with JavaScript in the browser. What are the benefits of using WASM for web development? Provide an example of a use case where WASM would be a good choice.
I need to store a collection of items where I will frequently be adding new items and searching for existing items. The order of items does not matter. What is the most appropriate data structure to use (e.g., Array, Linked List, Hash Table, Tree)? Explain the trade-offs and why your choice is the best for this scenario.
I have a slow-running SQL query. Here is the query: [paste query here]. And here is the table schema: [paste schema here]. Analyze the query and suggest ways to optimize it. Consider adding indexes, rewriting the query, or denormalizing the data.
Leverage Solid.js's fine-grained reactivity for a metrics dashboard. Features: 1. createSignal for individual metrics. 2. createMemo for derived calculations. 3. createResource for async data fetching. 4. Live updates without virtual DOM overhead. 5. Multiple chart types (line, bar, pie). 6. Real-time WebSocket data streaming. 7. Granular updates only re-render changed cells. 8. Time range selector with transitions. Achieve 60fps performance with large datasets.
Detect and prevent memory leaks. Techniques: 1. Use browser DevTools memory profiler. 2. Heap snapshots comparison. 3. Clear event listeners on cleanup. 4. Unsubscribe from observables. 5. Clear timers and intervals. 6. Weak references for caches. 7. Avoid global variables accumulation. 8. Monitor production with tools like Sentry. Common causes: closures, forgotten subscriptions, detached DOM. Implement cleanup in useEffect/componentWillUnmount.
Implement caching with Redis. Patterns: 1. Cache-aside (lazy loading). 2. Write-through (update cache on write). 3. Write-behind (async cache updates). 4. Cache invalidation strategies. 5. TTL for automatic expiration. 6. Key naming conventions. 7. Data structures (strings, hashes, lists, sets). 8. Pub/Sub for real-time. Use for session storage, rate limiting, leaderboards. Monitor memory usage.
Optimize database performance with indexes. Strategies: 1. Index foreign keys. 2. Composite indexes for multi-column queries. 3. Covering indexes to avoid table lookups. 4. Partial indexes for filtered queries. 5. Monitor query plans (EXPLAIN). 6. Avoid over-indexing (write performance). 7. Index selectivity matters. 8. Regular index maintenance. Use for WHERE, JOIN, ORDER BY. Not for small tables or high-write scenarios.
Draft a high-performance React 19 Server Component for a 'Product Listing' page. Use the new 'use()' hook for data fetching and 'Suspense' for granular loading states. Implement a skeleton loader that matches the final UI layout. Ensure the component is 'async' and handles empty states and error boundaries gracefully. Focus on minimal client-side JS bundle size.
Optimize a slow-running SQL query on a 50M+ row table. Techniques to apply: 1. Add appropriate indexes on WHERE and JOIN columns. 2. Replace subqueries with CTEs (Common Table Expressions). 3. Use EXPLAIN ANALYZE to identify bottlenecks. 4. Partition large tables by date for faster scans. 5. Rewrite correlated subqueries as window functions. Provide before/after execution times and explain each optimization decision.
Optimize productivity by managing energy, not just time. Framework: 1. Identify your peak energy hours (track for 1 week). 2. Schedule deep work during peak times. 3. Batch low-energy tasks (emails, admin) during slumps. 4. Take strategic breaks (90-min work cycles). 5. Manage physical energy (nutrition, hydration, movement). 6. Manage emotional energy (positive people, gratitude). 7. Manage mental energy (single-tasking, minimize decisions). Most people peak mid-morning. Post-lunch dip is normal. Use ultradian rhythms. Protect your best hours. Energy > time for productivity. Based on 'The Power of Full Engagement'.