/mobile Handheld Friendly website
x64 Ubuntu : Intel® Q6600® one core |
Each table row shows performance measurements for this Lua program with a particular command-line input value N.
| N | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load |
|---|---|---|---|---|---|
| 12 | 0.87 | 0.95 | 18,180 | 477 | 9% 28% 25% 99% |
| 16 | 22.01 | 22.06 | 328,644 | 477 | 0% 0% 0% 100% |
| 20 | Timed Out | 477 |
Read the ↓ make, command line, and program output logs to see how this program was run.
Read binary-trees benchmark to see what this program should do.
Lua 5.2.1 Copyright (C) 1994-2012 Lua.org, PUC-Rio
NOT ACCEPTED: We accept the default GC settings.
-- The Computer Language Benchmarks Game -- http://benchmarksgame.alioth.debian.org/ -- contributed by Mike Pall -- modified by Sokolov yura collectgarbage("setstepmul", 0) -- sometimes it helps much. For this benchmark ~ 10% local function BottomUpTree(item, depth) if depth > 0 then local i = item + item depth = depth - 1 local left, right = BottomUpTree(i-1, depth), BottomUpTree(i, depth) return { item, left, right } else return { item } -- Faster for LuaJIT: return { item, false } end end local function ItemCheck(tree) if #tree == 3 then -- Faster for LuaJIT: if tree[2] then return tree[1] + ItemCheck(tree[2]) - ItemCheck(tree[3]) else return tree[1] end end local N = tonumber(arg and arg[1]) or 0 local mindepth = 4 local maxdepth = mindepth + 2 if maxdepth < N then maxdepth = N end do local stretchdepth = maxdepth + 1 local stretchtree = BottomUpTree(0, stretchdepth) io.write(string.format("stretch tree of depth %d\t check: %d\n", stretchdepth, ItemCheck(stretchtree))) end local longlivedtree = BottomUpTree(0, maxdepth) for depth=mindepth,maxdepth,2 do local iterations = 2 ^ (maxdepth - depth + mindepth) local check = 0 for i=1,iterations do check = check + ItemCheck(BottomUpTree(1, depth)) + ItemCheck(BottomUpTree(-1, depth)) end io.write(string.format("%d\t trees of depth %d\t check: %d\n", iterations*2, depth, check)) end io.write(string.format("long lived tree of depth %d\t check: %d\n", maxdepth, ItemCheck(longlivedtree)))
Tue, 29 Jan 2013 04:25:00 GMT COMMAND LINE: /usr/local/src/lua-5.2.1/install/bin/lua binarytrees.lua-3.lua 20 TIMED OUT after 3600s PROGRAM OUTPUT: