Agoric / agoric-sdk

monorepo for the Agoric Javascript smart contract platform
Apache License 2.0
327 stars 206 forks source link

Supporting batching of iterators so a chunk can process in one crank #4776

Open turadg opened 2 years ago

turadg commented 2 years ago

What is the Problem Being Solved?

Some things can't be sync because they'd be too large to process in one crank. A simple async iterator would process each item in a separate turn. We need a batching capability so that an async iterator can synchronously process a batch in one crank.

Description of the Design

TBD

Security Considerations

--

Test Plan

--

Tartuffo commented 2 years ago

Looks like a SwingSet feature ask, so adding SwingSet label. FYI @warner

Tartuffo commented 2 years ago

One example was liquidation, but if we this one at a time we don't need it. But we need to investigate if there are any other examples we would cross crank boundaries.

mhofman commented 2 years ago

Note: breaking up each item in a different crank involves the kernel and may ultimately become too inefficient, at which point we'll probably need a mechanism sensitive to the remaining meter value akin to requestIdleCallback's IdleDeadline, which obviously introduces a risk of code being able to sense how much computation other code in the same vat performs.

warner commented 1 year ago

As discussed last week: