ocsigen / ocsigen/reactiveData

RList's merge operation is O(n)

Open
#11 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
OCaml
Stars
52
Forks
10
Avg merge
4m
Merged PRs (30d)
1

Description

The choice of 'a list as the exposed data type imposes slow O(n) patch application.
It'd be nice to have another module using another list-like data type (something similar to Okasaki's random access lists or such) which would allow for more efficient merging. Getting an 'a list back (which should be a rare event) would likely be O(n log n), but any operation (but taking the head) on the list would be O(n), so that's OK -- plus there wouldn't be hidden costs.

Alternatively, it could make sense not to update the current value eagerly, and to apply the patches lazily on request of the value (e.g. Tyxml_js works directly with the patch event, so there's no need to compute the actual list value in that case).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the current RList implementation and the patch-application path; the issue does not name files or tests. Review the Tyxml_js example linked in the issue for the lazy-consumption alternative. Done would require an agreed design and implementation that improves merge costs without imposing the current eager-list behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.