Learn R Programming

shard (version 0.1.0)

pool_lapply: Parallel Dispatch with Async Workers

Description

An alternative dispatch that uses parallel::parLapply-style execution but with supervision. This is a simpler interface for basic parallel apply.

Usage

pool_lapply(X, FUN, ..., pool = NULL, chunk_size = 1L)

Value

A list of results.

Arguments

X

List or vector to iterate over.

FUN

Function to apply to each element.

...

Additional arguments to FUN.

pool

A shard_pool object. If NULL, uses current pool.

chunk_size

Integer. Elements per chunk (default 1).

Examples

Run this code
# \donttest{
pool_create(2)
result <- pool_lapply(1:4, function(x) x^2, pool = pool_get())
pool_stop()
# }

Run the code above in your browser using DataLab