[Tarantool-patches] [PATCH v2 luajit 11/41] perf: adjust k-nucleotide in LuaJIT-benches
Sergey Kaplun
skaplun at tarantool.org
Sat Jan 3 09:38:21 MSK 2026
Hello, Sergey!
Please consider my answers below.
On 02.01.26, Sergey Bronnikov wrote:
> Hello, Sergey,
>
> please see my comments.
>
> Sergey
>
> On 12/26/25 12:17, Sergey Kaplun wrote:
> > This patch adjusts the aforementioned test to use the benchmark
> > framework introduced before. The default arguments are adjusted
> > according to the <PARAM_x86.txt> file. The arguments to the script still
> > can be provided in the command line run.
> >
> > The benchmark input is given by redirecting the corresponding
> > <FASTA_5000000> file generated by the `libs/fasta.lua 5e6`. The output
> > from the benchmark is redirected to /dev/null. All checks are done by
> > the comparison with the precomputed values for the aforementioned file.
> > ---
> > perf/LuaJIT-benches/k-nucleotide.lua | 96 ++++++++++++++++++++++++----
> > 1 file changed, 85 insertions(+), 11 deletions(-)
> >
> > diff --git a/perf/LuaJIT-benches/k-nucleotide.lua b/perf/LuaJIT-benches/k-nucleotide.lua
> > index 0bfb41be..e92429e8 100644
> > --- a/perf/LuaJIT-benches/k-nucleotide.lua
> > +++ b/perf/LuaJIT-benches/k-nucleotide.lua
> > @@ -1,3 +1,10 @@
> > +-- The benchmark that checks the performance of hash tables.
> > +-- The program reads the redirected FASTA format file from stdin,
> > +-- extracts DNA sequence THREE, and counts the specific sequences.
> > +-- For the details see:
> > +--https://benchmarksgame-team.pages.debian.net/benchmarksgame/description/knucleotide.html
<snipped>
> > @@ -24,10 +31,11 @@ local function frequency(seq, k)
> > local fa, fb = freq[a], freq[b]
> > return fa == fb and a > b or fa > fb
> > end)
> > + local res = {}
> > for _,c in ipairs(sfreq) do
> > - io.write(string.format("%s %0.3f\n", c, (freq[c]*100)/sum))
> > + res[c] = freq[c]*100/sum
> add more whitespaces please
Added:
===================================================================
diff --git a/perf/LuaJIT-benches/k-nucleotide.lua b/perf/LuaJIT-benches/k-nucleotide.lua
index e92429e8..d0faa45d 100644
--- a/perf/LuaJIT-benches/k-nucleotide.lua
+++ b/perf/LuaJIT-benches/k-nucleotide.lua
@@ -33,7 +33,7 @@ local function frequency(seq, k)
end)
local res = {}
for _,c in ipairs(sfreq) do
- res[c] = freq[c]*100/sum
+ res[c] = freq[c] * 100 / sum
end
return res
end
===================================================================
> > end
> > - io.write("\n")
> > + return res
> > end
> >
> > local function readseq()
> > @@ -48,11 +56,77 @@ local function readseq()
> > return string.upper(table.concat(lines, "", 1, ln))
> > end
> >
> > -local seq = readseq()
> > -frequency(seq, 1)
> > -frequency(seq, 2)
> > -count(seq, "GGT")
> > -count(seq, "GGTA")
> > -count(seq, "GGTATT")
> > -count(seq, "GGTATTTTAATT")
> > -count(seq, "GGTATTTTAATTTATAGT")
> > +local function check_freq(res, expected)
> > + for k,v in pairs(expected) do
> > + assert(string.format("%0.3f", res[k]) == v,
> > + "Incorrect frequency for fragment " .. k)
> > + end
> > +end
> > +
> > +-- The input is generated by `fasta.lua 5e6'. The check function
> > +-- is corresponding.
> > +local N = 5e6
> > +-- See <libs/fasta.lua> for the details.
<snipped>
>
> I don't know why, but microbench cannot finish on my machine. And
> according to usage
>
> and implementation it is not expected any input or option.
It expects the FASTA_5000000 file as an redirected input from stdin.
--
Best regards,
Sergey Kaplun
More information about the Tarantool-patches
mailing list