跪拜 Guibai
← Back to the summary

AI-Generated 3D Dashboard Crashed After 3 Days: The Performance Cliff AI Can't See

AI helped me generate a cool 3D dashboard, and it crashed within 3 days of going live

Recently, Juejin is full of articles about using AI to write 3D dashboards and building digital twin parks with Three.js. The screenshots people post look smooth and sci-fi.

I got excited when I read them. I happened to have an internal logistics warehouse data dashboard project, and I thought: With AI now, who still writes WebGL line by line?

So I opened Cursor, switched to Claude 3.5 Sonnet, and typed that magical spell: "Help me write a Vue3 + Three.js data dashboard with a warehouse model, realtime display of shuttle car running tracks, sci-fi feel, with particle effects."

Ten minutes later, the code was out. I ran it, and damn, it really worked. The light strip lit up, particle effects appeared, and a truck 3D model slowly rotated on screen. I sent it to the product manager, who sent three thumbs up in a row and said it should go straight to production next week.

But I forgot: a demo and a data center are two different worlds.

On day one, the business volume was small and it barely held up. On day three, during the morning peak, 100,000 records came in. The dashboard went white, then the browser console showed that red error that made my heart skip:

WebGL context lost.

The page froze and fans spun wildly. I stared at the screen and suddenly understood the old saying on Juejin: AI can help you write code, but AI won't take the blame for you.

1. Where exactly did it choke?

I spent a whole day doing a postmortem on this "AI-generated" project, peeling back its gorgeous skin and finding all the classic pitfalls I knew.

Pit one: AI is a "memory assassin"

AI drew the shuttle car nicely. But how did it draw it? Inside the requestAnimationFrame loop, every time data updated, it directly created a new THREE.Mesh() and recreated the model.

In the demo, there was only 1 shuttle car, so you couldn't see the problem. But in the real warehouse, there are 200 cars, receiving real-time position updates every second.

That means 200 WebGL geometries and materials are created in memory every second, and never destroyed. The GPU memory was exhausted directly.

Pit two: It doesn't understand "unified batching"

To look cool, AI added a separate emissive material and shadows to every shelf. In Three.js, that's 200 independent Draw Calls. If the frame rate drops, it won't think like a human, asking "Should I use InstancedMesh to optimize rendering?"

AI's underlying logic is "good enough if it works", while real business logic is "you have to hold 60 frames".

Pit three: Dirty state accumulation

When AI wrote state updates, it drove Three.js directly through Vue's reactive data, but when the component was destroyed, it completely forgot to write dispose(). When the route switched, the scene and renderer stayed running in the background, leaking memory.

2. The paradox of the AI era: code becomes cheap, but "experience" doesn't change

In the AI era, the cost of writing a 3D dashboard's code went from a month down to ten minutes. But debugging a bug where GPU crashes under 100k-level concurrency still requires a solid day.

Looking at the 2000 lines of AI-generated code, there was not a single Object3D.remove(), no resource recycling mechanism, and no debounce or throttle. All "happy path", not a shred of "defensive programming".

That's like AI building you a fancy decorated villa that looks beautiful, but without any sewer lines or load-bearing walls. When 100 people actually live in it, the whole building collapses.

3. How I finally rescued it

I couldn't delete everything, because the AI-built model was indeed fast, so I only did "subtraction and transformation" on its foundation:

  1. Switch to instanced rendering: Rewrite all 200 shuttle cars and hundreds of shelves with InstancedMesh. One Draw Call handles all rendering.
  2. Force manual cleanup: In the component unmount onBeforeUnmount lifecycle, manually traverse all nodes to dispose() materials and geometries, and clear the renderer.
  3. Consolidate update frequency: Stop rendering every time WebSocket pushes data. Instead, use requestAnimationFrame and a throttle function to merge and read the latest state only every 16ms, then update.

After the changes, frame rate stabilised at 60 fps, memory stabilised at 300MB, and the dashboard finally didn't crash.

4. To fellow front-end engineers swept up by AI

These days I see articles like "make 3D without writing a line of code" and "AI crushes XX framework", and I can't help but laugh.

Don't get me wrong, I'm absolutely an AI enthusiast. I can't write code without Cursor now; it's my best co-pilot.

But this pitfall completely woke me up to one thing: AI lowered the "from 0 to 1" barrier to ankle height, but the "from 1 to 100" performance cliff still requires us to climb it ourselves.

In the AI era, the moat of front-end engineers has changed. It's no longer "who memorizes more APIs" or "who writes cool animations". It's who can tell at a glance how the page will die in a real production environment.


Final note: Those articles showing off AI tricks are just for fun. When it gets to your own project, stay alert. Check whether the AI-generated code contains those "time bombs" that will wake you up with a call at 2 a.m.

Comments

Top 8 from juejin.cn, machine-translated. The original thread is authoritative.

PBitW 2 likes

Actually you just need to tell the AI to do it like this: Switch to instanced rendering: rewrite those 200 shuttle vehicles and several hundred shelves entirely with InstancedMesh. All rendering done in one draw call. Force manual cleanup: in the onBeforeUnmount lifecycle when the component unmounts, manually iterate all nodes to dispose() materials and geometries, and clear the renderer. Consolidate update frequency: don't re-render every time WebSocket pushes data. Instead use requestAnimationFrame and a throttle function, only merge and read the latest state every 16ms before updating. Then you can just go for it. The point is, if you don't tell it, it won't do it!

isyou401

3.5? Isn't it 5.5 now? What year is it?

爱吃芝士的大螃蟹

My boss wants me to do online referral signups, 1000–2000 per day, finish 100—help a kid out.

zhouwx5512

What year did you travel here from?

jiong2468

Claude 3.5 Sonnet...

凌川江雪

4.5 is already an ancient model, and you're still on 3.5? Try GPT-6.

liouviller

Claude 3.5 Sonnet is from when?

clench

Run a stress test then.