performance measurements

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
250,000Failed  555   

Read the ↓ make, command line, and program output logs to see how this program was run.

Read reverse-complement benchmark to see what this program should do.


Lua 5.3.0 Copyright (C) 1994-2015, PUC-Rio

 reverse-complement Lua program source code

-- The Computer Language Benchmarks Game
-- contributed by Mike Pall (with ideas from Rici Lake)

local sub = string.sub
iubc = setmetatable({
  A="T", C="G", B="V", D="H", K="M", R="Y",
  a="T", c="G", b="V", d="H", k="M", r="Y",
  T="A", G="C", V="B", H="D", M="K", Y="R", U="A",
  t="A", g="C", v="B", h="D", m="K", y="R", u="A",
  N="N", S="S", W="W", n="N", s="S", w="W",
}, { __index = function(t, s)
  local r = t[sub(s, 2)]..t[sub(s, 1, 1)]; t[s] = r; return r end })

local wcode = [=[
return function(t, n)
  if n == 1 then return end
  local iubc, sub, write = iubc, string.sub, io.write
  local s = table.concat(t, "", 1, n-1)
  for i=#s-59,1,-60 do
for i=59,3,-4 do wcode = wcode.."iubc[sub(s, i+"..(i-3)..", i+"..i..")], " end
wcode = wcode..[=["\n")
  local r = #s % 60
  if r ~= 0 then
    for i=r,1,-4 do write(iubc[sub(s, i-3 < 1 and 1 or i-3, i)]) end
local writerev = loadstring(wcode)()

local t, n = {}, 1
for line in io.lines() do
  local c = sub(line, 1, 1)
  if c == ">" then writerev(t, n); io.write(line, "\n"); n = 1
  elseif c ~= ";" then t[n] = line; n = n + 1 end
writerev(t, n)

 make, command-line, and program output logs

Tue, 13 Jan 2015 01:26:09 GMT

/usr/local/src/lua-5.3.0/bin/lua  revcomp.lua 0 < revcomp-input250000.txt



/usr/local/src/lua-5.3.0/bin/lua: revcomp.lua:32: attempt to call a nil value (global 'loadstring')
stack traceback:
	revcomp.lua:32: in main chunk
	[C]: in ?

Revised BSD license

  Home   Conclusions   License   Play