biofast icon indicating copy to clipboard operation
biofast copied to clipboard

Use `-d:danger --gc:arc` for Nim

Open Benjamin-Lee opened this issue 4 years ago • 4 comments

At least for Nim development, the use of the -d:danger flag can dramatically improve speed if you take care when writing your code. I imagine it is likely the case that other languages here have their own optimal configurations. I might be missing it, but I can't see what flags were used during compilation. Is that documented anywhere?

Benjamin-Lee avatar Aug 11 '20 00:08 Benjamin-Lee

See Makefile in individual directory.

lh3 avatar Aug 11 '20 00:08 lh3

Completely missed that. Thanks!

Benjamin-Lee avatar Aug 11 '20 00:08 Benjamin-Lee

@lh3 or @Benjamin-Lee could we reopen this issue?

it doesn't use -d:danger: for eg: https://github.com/lh3/biofast/blob/master/fqcnt/Makefile (ditto with https://github.com/lh3/biofast/blob/master/bedcov/Makefile)

fqcnt_nim1_klib:fqcnt_nim1_klib.nim ../lib/klib.nim
	$(NIM) c -d:release -d:nimEmulateOverflowChecks --bound_checks:off -p:../lib -o:$@ $<

we should rerun the benchmarks for nim with

$(NIM) c -d:danger -p:../lib -o:$@ $<

EDIT

running on a docker container, I get:

nim c  -d:release -d:nimEmulateOverflowChecks --bound_checks:off -o:/tmp/z01 -p:../lib bedcov_nim1_klib.nim
time /tmp/z01 biofast-data-v1/ex-rna.bed biofast-data-v1/ex-anno.bed >/dev/null

8.927s

with s/-d:release -d:nimEmulateOverflowChecks --bound_checks:off/-d:danger/ I get: 6.792s

with -d:danger --passc:-flto I get: 6.383s

with -d:danger --gc:arc I get: 5.90s

interpolating linearly, this would give: echo 'echo 16.6 / (8.927 / 6.38) ' | nim r - 11.1 instead of 16.6 in this line of https://github.com/lh3/biofast:

bedcov_nim1_klib.nim | Nim | 16.6 | 248.4 | 26.0 | 34.1

timotheecour avatar Oct 13 '20 20:10 timotheecour

It must have completely slipped my mind when I looked at the makefile. -d:danger --gc:arc is the right way to compile the code. It's what I use every day in my bioinformatics research using Nim.

Benjamin-Lee avatar Nov 19 '20 06:11 Benjamin-Lee