Skip to content

Reimplement calcscore.js in C++ #11

@ihh

Description

@ihh

Motivated by #7, the idea is to accelerate score calculations inside the AWS Lambda call.

Essentially you'd be reimplementing calcscore.js but reading the history in as a CigarTree directly from a JSON file. The idea will be that the Lambda script will then pass data to this program (probably by saving the CigarTree and sequences as a temporary local file).

C++ is probably easiest. I'd probably use Nick Lohmann's JSON parser. I think you could get away without using a matrix library since the only matrix operations are multiplications and it's probably more efficient to just code row-column multiplication by hand.

Originally posted by @ihh in #7

It is probably worth just confirming that you can reproduce the timing behavior locally by running calcscore.js.

A quicker workaround might be to do some performance profiling of the JavaScript and use that to drive some data-guided optimizations. However in the longer term the C++ route will be faster.

The fiddliest algorithm involved is Felsenstein's pruning algorithm. I do have various C++ implementations of Felsenstein's algorithm kicking around (e.g. here) but I suspect they'll have too much baggage to save you real time; you might as well implement it yourself, it's a fun coding exercise.

Originally posted by @ihh in #7

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions