/mobile Handheld Friendly website
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 |
|---|---|---|---|---|---|
| 500,000 | 0.21 | 0.21 | 260 | 264 | 0% 0% 9% 100% |
| 5,000,000 | 2.02 | 2.02 | 1,076 | 264 | 3% 1% 1% 100% |
| 50,000,000 | 19.24 | 19.25 | 1,080 | 264 | 0% 1% 1% 100% |
Read the ↓ make, command line, and program output logs to see how this program was run.
Read thread-ring benchmark to see what this program should do.
Lua 5.2.1 Copyright (C) 1994-2012 Lua.org, PUC-Rio
-- The Computer Language Benchmarks Game -- http://benchmarksgame.alioth.debian.org/ -- contributed by Sam Roberts -- reviewed by Bruno Massa require"coroutine" -- first and only argument is number of token passes local n = assert(tonumber(arg[1])) -- fixed size pool local poolsize = 503 local threads = {} -- cache these to avoid global environment lookups local create = coroutine.create local resume = coroutine.resume local yield = coroutine.yield local id = 1 local token = 0 local ok local body = function(token) while true do token = yield(token + 1) end end -- create all threads for id = 1, poolsize do threads[id] = create(body) end -- send the token repeat if id == poolsize then id = 1 else id = id + 1 end ok, token = resume(threads[id], token) until token == n print(id)
Wed, 30 Jan 2013 04:33:40 GMT COMMAND LINE: /usr/local/src/lua-5.2.1/install/bin/lua threadring.lua-3.lua 50000000 PROGRAM OUTPUT: 292