JuliaFolds / Transducers.jl

Efficient transducers for Julia
https://juliafolds.github.io/Transducers.jl/dev/
MIT License
433 stars 24 forks source link
distributed-computing high-performance iterators julia map-reduce parallel transducers

Transducers.jl: Efficient transducers for Julia

Stable documentation Latest documentation Travis Status codecov.io Coverage Status Aqua QA

Transducers.jl provides composable algorithms on "sequence" of inputs. They are called transducers, first introduced in Clojure language by Rich Hickey.

Using transducers is quite straightforward, especially if you already know similar concepts in iterator libraries:

using Transducers
1:40 |> Partition(7) |> Filter(x -> prod(x) % 11 == 0) |> Cat() |> Scan(+) |> sum

However, the protocol used for the transducers is quite different from iterators and results in a better performance for complex compositions. Furthermore, some transducers support parallel execution. If a transducer is composed of such transducers, it can be automatically re-used both in sequential (foldl etc.) and parallel (reduce etc.) contexts.

See more in the documentation.

If you are interested in parallel programming in general, see also: A quick introduction to data parallelism in Julia

Installation

using Pkg
Pkg.add("Transducers")

Related packages

Following packages are supported by Transducers.jl. In particular, they rely on the Transducers.jl protocol to support multi-threading, multi-processing, and GPU-based parallelism.