Questions tagged [performance]
Post a PromptPrompts focused on speed and efficiency.
12 prompts
20votes
1answers
5.2kviews
Bounding concurrency in an asyncio scraper so I stop opening 5000 sockets at once
I asked for an async version of a fetcher and the model gleefully did await asyncio.gather([fetch(u) for u in urls]) over 5000 URLs. It opened every connection simultaneously, the event loop thrashed,
23votes
2answers
2.7kviews
Real-time metrics dashboard with sparkline gauges over a websocket feed
I was building a live ops board that streams a few dozen metrics over a websocket, each shown as a number plus a rolling sparkline. The naive build re-rendered the entire React tree on every message a
8votes
0answers
968views
Inline SVG sparklines inside a table that stay readable at 20px tall
I needed a trend sparkline in the last column of a dense metrics table, one row per service. Every generated version either drew axes (pointless at that size) or normalized each row independently so a
12votes
1answers
2.3kviews
One-shot prompt for a Rust + wasm image filter module wired into a web app cleanly
I wanted a real Rust-to-WASM module doing per-pixel work off the main thread, not a toy that ships 4MB of glue and blocks the UI on load. Most prompts gave me code that assumed a specific bundler and
22votes
1answers
2.2kviews
Debugging an intermittent asyncio race the model kept papering over
Had a flaky test that failed maybe 1 in 30 runs. Every model I tried "fixed" it by adding an await asyncio.sleep(0.1) somewhere, which is not a fix, it is a bribe. The real bug was two coroutines muta
8votes
1answers
2.0kviews
Gemini prompt for an animated gradient hero background that doesn't jank on scroll
I wanted a slow, living gradient behind a hero, the kind that feels expensive. My first attempts animated background-position on a huge gradient and it hitched badly on scroll and cooked laptop fans,
46votes
0answers
3.9kviews
Prompt for a React render-performance audit that names the actual wasted re-renders
Performance is a feature on my team, and "make it faster" prompts just sprinkled useMemo everywhere, including on primitives, which made the code worse and slower to read for zero gain. I reframed it
16votes
2answers
3.1kviews
Canvas candlestick chart that survives a code review at 50k OHLC bars
Our desk needed an intraday candlestick view that stays at 60fps when someone scrolls a full year of 1-minute bars. The obvious SVG version from the model died around 8k nodes, and the first canvas at
12votes
0answers
1.3kviews
Measure-before-optimize prompt so the model stops tuning cold code
I asked a local Llama-3 70B to "make this data pipeline faster" and it micro-optimized a list comprehension that runs once at startup while ignoring the O(n^2) join in the hot loop. Textbook: it optim
9votes
0answers
1.4kviews
Responsive camera framing in three.js so a scene fills phone portrait and desktop wide equally
My 3D product scene looked perfect on my 16:9 monitor and then the hero object was tiny and floating in the corner on a phone in portrait. Classic: I was only adjusting aspect on resize, not the actua
14votes
1answers
2.0kviews
Asteroids prompt with real thrust inertia and screen wrap that doesn't pop
Wanted a proper Asteroids: momentum-based ship, thrust and rotation, bullets, splitting rocks. The tricky feel bits are the inertia (you drift, you don't stop instantly) and seamless screen wrap so ob
13votes
1answers
1.6kviews
Verlet rope and cloth prompt that stays stable instead of exploding
I love verlet integration for cheap 2D physics, but every quick AI version I got would look great for two seconds and then the cloth would violently explode as constraints fought each other. The naive