Searching the best prompts from our community
Discover the most effective Performance prompts. High-quality templates curated by experts to help you get professional AI results.
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 c...
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...
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 (effic...
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 navi...
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, bun...
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 th...
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 b...
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-ti...
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 p...
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. ...
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 se...
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 bou...
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...
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 (nutri...