Best AI for coding / head-to-head
GLM 5.2 vs GPT-5.6 Lunafor coding
GPT-5.6 Luna wins, 93–92
Same 18 coding tasks, marked blind by three rival labs. GPT-5.6 Luna took 5 tasks, GLM 5.2 took 4, 9 tied. Tested 16 Aug 2026.
Where they differed most
Write a debounce function in TypeScript that preserves the argument types of the wrapped function, returns a function with a .cancel() method, and does not use 'any'. Explain in one sentence why the naive generic signature loses type information.
Here is the TypeScript debounce function:
```typescript
function debounce<A extends unknown[]>(
func: (...args: A) => unknown,
wait: number
): ((...args: A) => void) & { cancel: () => void } {
let timeoutId: ReturnType<typeof setTimeout> | undefined;
const debounced = ((...args: A): void => {
if (timeoutId !== undefined) {
clearTimeout(timeoutId);
}
timeoutId = setTimeout(() => func(...args), wait);
}) as ((...args: A) => void) & { cancel: () => void };
debounced.cancel = () => {
if (timeoutId !== undefined)…```ts
type Debounced<F extends (...args: never[]) => unknown> =
((...args: Parameters<F>) => void) & {
cancel(): void;
};
function debounce<F extends (...args: never[]) => unknown>(
fn: F,
delay: number
): Debounced<F> {
let timer: ReturnType<typeof setTimeout> | undefined;
let pendingArgs: Parameters<F> | undefined;
const debounced = ((...args: Parameters<F>): void => {
pendingArgs = args;
if (timer !== undefined) {
clearTimeout(timer);
}
timer = setTimeout(() => {
const argsToUse = pendingArgs…Task by task
| Task | GLM 5.2 | GPT-5.6 Luna |
|---|---|---|
| Duration parser | 8 | 9 |
| Find the bug | 10 | 10 |
| SQL without window functions | 10 | 10 |
| Infinite useEffect | 10 | 9 |
| Typed debounce | 8 | 10 |
| Leftmost binary search | 10 | 10 |
| Security review | 9 | 9 |
| Safe migration | 7 | 8 |
| Fix the code not the test | 10 | 10 |
| Race condition | 9 | 10 |
| Retry with backoff | 10 | 9 |
| Recursive type | 10 | 9 |
| Bash one-liner | 10 | 9 |
| Explain and cost | 9 | 9 |
| Regex with limits | 8 | 8 |
| Callback to async | 10 | 10 |
| Diagnose from a trace | 8 | 8 |
| Idempotency | 9 | 10 |
Full receipts: GLM 5.2, GPT-5.6 Luna · judges claude-sonnet-5, gemini-3.1-pro-preview, gpt-5.6-terra
Questions people ask
Which is better for coding: GLM 5.2 or GPT-5.6 Luna?
GPT-5.6 Luna — it scored 93/100 against 92/100 on our 18-task coding suite, winning 5 tasks to 4 with 9 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 Sol · GPT-5.6 Luna vs GPT-5.6 Terra · GPT-5.3-Codex vs GPT-5.6 Luna · GPT-5.5 vs GPT-5.6 Luna · GPT-5.6 Luna vs Qwen3.7 Max · Claude Opus 4.8 vs GPT-5.6 Luna
Full ranking: Best AI for coding · model pages: GLM 5.2, GPT-5.6 Luna