Skip to content

Performance issues for maps #355

@cmester0

Description

@cmester0

When having large maps updating values gets very slow. The following code:

pred map_test_fold i:int, i:V, i:V, o:std.map int V.
map_test_fold I V U M :-
  std.fold
    {std.iota I}
    {std.map.make cmp_term}
    (k\m\ std.map.add k V m) /* insert */
    Mtemp,
  std.fold
    {std.iota I}
    Mtemp
    (k\m\ std.map.add k U m) /* update */
    M.

gets quite slow for e.g. I = 6000, V = {std.iote 20}, U = {std.iota 19}.

@gares id this might already be tested at https://github.com/LPCIC/elpi/blob/master/tests/suite/performance_FO.ml#L65-L80 .

When running the test it seems to copy the entire AVL tree for each update, instead of just the path.
This might just the tree generating a lot of variables. Alternatively it might be copying data instead of using names/pointers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions