Pebaz / nimporter

Compile Nim Extensions for Python On Import!
MIT License
824 stars 33 forks source link

Why use --gc:markAndSweep as default? #24

Closed Benjamin-Lee closed 4 years ago

Benjamin-Lee commented 4 years ago

Is there a reason to use this over refc for Nimporter? Nimpy suggested compiler invocation makes no mention of it:

# Compile on Windows:
nim c --threads:on --app:lib --out:mymodule.pyd mymodule
# Compile on everything else:
nim c --threads:on --app:lib --out:mymodule.so mymodule

Additionally, microbenchmarking suggests is it is slower than refc (nimr is just an alias for nim c -r --hints:off --verbosity:0):

~/D/P/R/l/librtd-py ❯❯❯ nimr -d:danger --opt:speed --gc:markAndSweep --threads:on call_cli.nim; rm test.jsonl
Success: Analyzed RTD for 50 sequences totaling 1492590 bp in 19.9 seconds.
~/D/P/R/l/librtd-py ❯❯❯ nimr -d:danger --opt:speed --gc:refc --threads:on call_cli.nim; rm test.jsonl
Success: Analyzed RTD for 50 sequences totaling 1492590 bp in 15.1 seconds.
~/D/P/R/l/librtd-py ❯❯❯ nimr -d:danger --opt:speed --gc:arc --threads:on call_cli.nim; rm test.jsonl
Success: Analyzed RTD for 50 sequences totaling 1492590 bp in 12.5 seconds.
Pebaz commented 4 years ago

Hello @Benjamin-Lee !

I have not reviewed the default compiler flags in a while. I'm sure that they need to be updated.

Thanks for looking into this I will determine if I can change the flags to help performance as you have shown.