On Thursday, 11 June 2020 at 16:13:34 UTC, duck_tape wrote:
Hi! I'm new to dlang but loving it so far! One of my favorite first things to implement in a new language is an interval library. In this case I want to submit to a benchmark repo: https://github.com/lh3/biofast

If anyone is willing to take a look and give some feedback I'd be very appreciative! Specifically if you have an performance improvement ideas: https://github.com/sstadick/dgranges/pull/1

Currently my D version is a few seconds slower than the Crystal version. putting it very solid in third place overall. I'm not really sure where it's falling behind crystal since `-release` removes bounds checking. I have not looked at the assembly between the two, but I suspect that Crystal inlines the callback and D does not.

I also think there is room for improvement in the IO, as I'm just using the defaults.

Add to your dub.json the following:

"""
        "buildTypes": {
                "release": {
                        "buildOptions": [
                                "releaseMode",
                                "inline",
                                "optimize"
                        ],
                        "dflags": [
                                "-boundscheck=off"
                        ]
                },
        }
"""

dub build --compiler=ldc2 --build=release

Mir Slices instead of standard D arrays are faster. Athough looking at your code I don't see where you can plug them in. Just keep in mind.

Reply via email to