Skip to content

Async API #142

Open
Open
@davidbrochart

Description

Since CRDTs can be CPU-intensive, I'm wondering if we could run all the Rust code in a separate thread, and have an async Python API that would not block while waiting for the CRDT operations to complete.
For instance:

async with doc.begin_transaction() as txn:
    await ytext.extend(txn, "foo")
    ...

delta = await encode_state_as_update(doc)
await apply_update(other_doc, delta)

I know that Ypy doesn't support multi-threading, but here all the Rust code would run in the same thread (but this would not be the main Python thread).
I think this would be a nice performance gain on multi-core CPUs. On single-core CPUs the non-async API would be a better choice.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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