Closed bicycle1885 closed 7 years ago
The performance of kmer iterator improves for longer k-mers, too. However, for long k-mers, the cost of array access becomes dominant in composition
as shown above. The following benchmarks do not access arrays so it is apparent that the performance has improved.
this branch:
julia> @benchmark count(_->true,each(DNAKmer{8}, seq))
BenchmarkTools.Trial:
memory estimate: 80 bytes
allocs estimate: 4
--------------
minimum time: 27.570 μs (0.00% GC)
median time: 28.470 μs (0.00% GC)
mean time: 30.255 μs (0.00% GC)
maximum time: 118.795 μs (0.00% GC)
--------------
samples: 10000
evals/sample: 1
julia> @benchmark count(_->true,each(DNAKmer{16}, seq))
BenchmarkTools.Trial:
memory estimate: 80 bytes
allocs estimate: 4
--------------
minimum time: 27.635 μs (0.00% GC)
median time: 30.678 μs (0.00% GC)
mean time: 32.448 μs (0.00% GC)
maximum time: 120.867 μs (0.00% GC)
--------------
samples: 10000
evals/sample: 1
julia> @benchmark count(_->true,each(DNAKmer{32}, seq))
BenchmarkTools.Trial:
memory estimate: 80 bytes
allocs estimate: 4
--------------
minimum time: 27.689 μs (0.00% GC)
median time: 27.756 μs (0.00% GC)
mean time: 30.375 μs (0.00% GC)
maximum time: 265.790 μs (0.00% GC)
--------------
samples: 10000
evals/sample: 1
master:
julia> @benchmark count(_->true,each(DNAKmer{8}, seq))
BenchmarkTools.Trial:
memory estimate: 80 bytes
allocs estimate: 4
--------------
minimum time: 37.417 μs (0.00% GC)
median time: 37.497 μs (0.00% GC)
mean time: 40.360 μs (0.00% GC)
maximum time: 171.461 μs (0.00% GC)
--------------
samples: 10000
evals/sample: 1
julia> @benchmark count(_->true,each(DNAKmer{16}, seq))
BenchmarkTools.Trial:
memory estimate: 80 bytes
allocs estimate: 4
--------------
minimum time: 35.936 μs (0.00% GC)
median time: 36.722 μs (0.00% GC)
mean time: 38.952 μs (0.00% GC)
maximum time: 151.353 μs (0.00% GC)
--------------
samples: 10000
evals/sample: 1
julia> @benchmark count(_->true,each(DNAKmer{32}, seq))
BenchmarkTools.Trial:
memory estimate: 80 bytes
allocs estimate: 4
--------------
minimum time: 35.939 μs (0.00% GC)
median time: 37.472 μs (0.00% GC)
mean time: 38.220 μs (0.00% GC)
maximum time: 158.646 μs (0.00% GC)
--------------
samples: 10000
evals/sample: 1
Merging #462 into master will decrease coverage by
0.14%
. The diff coverage is95.65%
.
@@ Coverage Diff @@
## master #462 +/- ##
==========================================
- Coverage 65.17% 65.02% -0.15%
==========================================
Files 159 159
Lines 11328 11335 +7
==========================================
- Hits 7383 7371 -12
- Misses 3945 3964 +19
Impacted Files | Coverage Δ | |
---|---|---|
src/seq/composition.jl | 63.26% <100%> (ø) |
:arrow_up: |
src/seq/kmer.jl | 86.51% <66.66%> (+0.3%) |
:arrow_up: |
src/seq/eachkmer.jl | 94.23% <97.56%> (+0.61%) |
:arrow_up: |
src/seq/nmask.jl | 26.38% <0%> (-25.01%) |
:arrow_down: |
src/seq/refseq.jl | 88.57% <0%> (-1.43%) |
:arrow_down: |
src/align/alignment.jl | 85.14% <0%> (-1%) |
:arrow_down: |
src/intervals/interval.jl | 92% <0%> (+1.33%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 70ea67e...46a1b38. Read the comment docs.
I'll merge this soon if no objections.
On my machine,
composition
is now ~20-30% faster for short kmers (e.g. 4-8).