Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support batched try_locks #309

Open
HalosGhost opened this issue Nov 15, 2024 · 0 comments
Open

Support batched try_locks #309

HalosGhost opened this issue Nov 15, 2024 · 0 comments
Assignees
Labels
enhancement/optimization Improves performance enhancement/refactor Improves flexibility/maintainability

Comments

@HalosGhost
Copy link
Collaborator

Right now, any contract which has a list of keys it must lock to succeed will write their own version of the following boilerplate (pseudocode, of course):

lt = READ # or WRITE
for each k in keys:
    l = try_lock(k, lt)
    if l is not successful:
        return failure

This isn't particularly hard to write or difficult to write correctly, but it means many execution context switches (from the runner waiting on the broker(?), and vice versa), and will likely be frequently needed.

A hypothetical try_batch_lock() which takes a vector of keys in place of a single key, would reduce this boilerplate to the much simpler:

lt = READ # or WRITE
if try_batch_lock(keys, lt) is not successful:
    return failure

Moreover, this could dramatically reduce the roundtrip count between the runner and the external execution environment.

@HalosGhost HalosGhost added enhancement/optimization Improves performance enhancement/refactor Improves flexibility/maintainability labels Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement/optimization Improves performance enhancement/refactor Improves flexibility/maintainability
Projects
None yet
Development

No branches or pull requests

2 participants