Skip to content

Update table sorting API to allow for callback #616

Description

@molpopgen

Sorting an edge table is quite expensive, and the current implementation can be out-performed by client code. The main motivation here is to speed up forward simulations.

It has been proposed to allow a callback to be passed to tsk_table_collection_sort that would look something like:

typedef int (*edge_table_sort_callback)(tsk_table_collection_t * tables, void * tbd);

I'd like to propose adding the following callback as a "built in" in tskit:

int tsk_do_not_sort_edges(tsk_table_collection_t * tables, void * tbd)
{
    return 0;
}

The idea is that this call back does nothing, meaning that client code is assuming 100% responsibility here and accepting that the integrity checker will double-check their work. It turns out to be very fiddly to get complex callbacks in other languages to work when the calling conventions differ from C. (Read: my attempts to mock this up so far all segfault.). Thus, allowing the step to be just skipped internally would be useful.

Metadata

Metadata

Labels

C APIIssue is about the C API

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions