Looking for a Code Review of a Bioinformatics POC

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Jun 11 22:19:27 UTC 2020


On Thu, Jun 11, 2020 at 04:13:34PM +0000, duck_tape via Digitalmars-d-learn wrote:
[...]
> 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.

To encourage inlining, you could make it an alias parameter instead of a
delegate, something like this:

	void overlap(alias cb)(SType start, SType stop) { ... }
	...
	bed[chr].overlap!callback(st0, en0);

This doesn't guarantee inlining, though. And no guarantee it will
actually improve performance.


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

I wouldn't spend too much time optimizing I/O without profiling it
first, to check that it's actually a bottleneck. If I/O turns out to be
a real bottleneck, you could try using std.mmfile.MmFile to mmap the
input directly into the program's address space, which should give you a
speed boost.


T

-- 
An imaginary friend squared is a real enemy.


More information about the Digitalmars-d-learn mailing list