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  593   

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.

 notes

Lua 5.2.1 Copyright (C) 1994-2012 Lua.org, PUC-Rio

 reverse-complement Lua #3 program source code

-- The Computer Language Benchmarks Game
-- http://benchmarksgame.alioth.debian.org/
-- contributed by Mike Pall (with ideas from Rici Lake)
-- modified by Sokolov Yura

local len, sub, concat = string.len, string.sub, table.concat
local write, mod = io.write, math.mod

local function writerev(p, np, f, lo, hi)
  if lo <= hi then np = np + 1; p[np] = concat(f, "", lo, hi) end
  if np ~= 0 then
    local r = ""
    for i=np,1,-1 do
      local s = r..p[i]
      local sn = len(s)
      for i=1,sn-59,60 do write(sub(s, i, i+59), "\n") end
      r = sub(s, sn-mod(sn, 60)+1)
    end
    if r ~= "" then write(r, "\n") end
  end
end

local 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 p, f, np, nf = {}, {}, 0, 1631
for line in io.lines() do
  local c = sub(line, 1, 1)
  if c == ">" then
    writerev(p, np, f, nf, 1630); np = 0; nf = 1631
    write(line, "\n")
  elseif c ~= ";" then
    for i=1,len(line),4 do nf = nf - 1; f[nf] = iubc[sub(line, i, i+3)] end
    if nf <= 30 then
      np = np + 1; p[np] = concat(f, "", nf, 1630); nf = 1631
    end
  end
end
writerev(p, np, f, nf, 1630)

 make, command-line, and program output logs

Wed, 30 Jan 2013 04:25:52 GMT

COMMAND LINE:
/usr/local/src/lua-5.2.1/install/bin/lua  revcomp.lua-3.lua 0 < revcomp-input250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AGGCGCGCGCCACCACGCCCGGCTAATTTTTGTATTTTTAGTAGAGACGGGGTTTCACCA
TGTTGGCCAGGCTGGTCTCGAACTCCTGACCTCAGGTGATCCGCCCGCCTCGGCCTCCCA
AAGTGCTGGGATTACAGGCGTGAGCCACCGCGCCCGGCCTTTTTGAGACGGAGTCTCGCT
CTGTCGCCCAGGCTGGAGTGCAGTGGCGCGATCTCGGCTCACTGCAACCTCCGCCTCCCG
GGTTCAAGCGATTCTCCTGCCTCAGCCTCCCGAGTAGCTGGGATTACAGGCGCGCGCCAC

/usr/local/src/lua-5.2.1/install/bin/lua: revcomp.lua-3.lua:17: attempt to call upvalue 'mod' (a nil value)
stack traceback:
	revcomp.lua-3.lua:17: in function 'writerev'
	revcomp.lua-3.lua:36: in main chunk
	[C]: in ?

Revised BSD license

  Home   Conclusions   License   Play