# 02 · concat-cost **演示**:2 万次 `..` 累积拼接 vs `table.concat`,比较 `os.clock` 耗时。 **运行时**:`lua54`、`luajit`。 **运行**: ```sh .tools/bin/lua54 scripts/run-example.lua examples/04-strings/02-concat-cost .tools/bin/lua54 scripts/test-example.lua examples/04-strings/02-concat-cost ``` **预期输出**(lua 5.4.9 / macOS arm64;耗时随机器变化): ```text concat_faster=true same_length=true ``` **看点**:`text = text .. x` 在循环里是 O(n²),`table.concat` 是一次性分配。 **注意**:只断言量级(2 倍),不写死毫秒。