Best AI for coding / head-to-head

Gemini 3.1 Pro Preview vs GPT-5.6 Terrafor coding

The verdict

GPT-5.6 Terra wins, 9388

Same 18 coding tasks, marked blind by three rival labs. GPT-5.6 Terra took 10 tasks, Gemini 3.1 Pro Preview took 3, 5 tied. Tested 16 Aug 2026.

Where they differed most

The task — Infinite useEffect

Explain precisely why this React effect loops forever, then give the fixed version. const [items, setItems] = useState([]); useEffect(() => { fetch('/api/items').then(r => r.json()).then(setItems); }, [items]);

### Why it loops forever

The infinite loop occurs due to a combination of **React's dependency tracking** and **JavaScript's reference equality**. 

Here is the precise step-by-step breakdown of the loop:

1. **Initial Render:** The component mounts, and `items` is initialized to an empty array `[]`.
2. **Effect Runs:** Because it's the first render, the `useEffect` runs and triggers the `fetch` request.
3. **State Update:** The fetch resolves, parses the JSON, and calls `setItems()` with the fetched array.
4. **Re-render:** Updating the state…
`items` is both:

1. A dependency of the effect: `}, [items])`
2. Updated by the effect: `.then(setItems)`

That creates this cycle:

1. Component renders with `items = []`.
2. The effect runs because it runs after the initial render.
3. `fetch` resolves and `r.json()` produces a new array/object value.
4. `setItems(newItems)` updates state.
5. React re-renders.
6. The `items` dependency is now a different reference than before (`Object.is(oldItems, newItems)` is false).
7. React runs the effect again.
8. It fetches again, creates another new a…

Task by task

TaskGemini 3.1 Pro PreviewGPT-5.6 Terra
Duration parser88
Find the bug910
SQL without window functions1010
Infinite useEffect810
Typed debounce910
Leftmost binary search910
Security review910
Safe migration89
Fix the code not the test109
Race condition99
Retry with backoff98
Recursive type109
Bash one-liner89
Explain and cost1010
Regex with limits89
Callback to async89
Diagnose from a trace88
Idempotency810

Full receipts: Gemini 3.1 Pro Preview, GPT-5.6 Terra · judges claude-sonnet-5, gpt-5.6-terra, grok-4.5

Questions people ask

Which is better for coding: Gemini 3.1 Pro Preview or GPT-5.6 Terra?

GPT-5.6 Terra — it scored 93/100 against 88/100 on our 18-task coding suite, winning 10 tasks to 3 with 5 tied. Every answer was marked blind by three judges from three rival AI labs.

How was this tested?

Both models answered the identical published coding tasks. Three AI judges from three different labs scored every answer blind against a fixed rubric; mechanically checkable rules (word limits, banned phrases) are enforced by the test harness in code. The raw outputs and judge verdicts are downloadable.

More coding head-to-heads: GPT-5.6 Luna vs GPT-5.6 Terra · Gemini 3.1 Pro Preview vs GPT-5.6 Luna · GPT-5.6 Sol vs GPT-5.6 Terra · Gemini 3.1 Pro Preview vs GPT-5.6 Sol · GLM 5.2 vs GPT-5.6 Terra · GPT-5.3-Codex vs GPT-5.6 Terra

Full ranking: Best AI for coding · model pages: Gemini 3.1 Pro Preview, GPT-5.6 Terra