All Projects → MichaelJWelsh → Ppipe

MichaelJWelsh / Ppipe

Licence: mit
A simple and lightweight Rust library for making iterator pipelines concurrent

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Ppipe

Tdp
The Darkest Pipeline - Multithreaded pipelines for modern C++
Stars: ✭ 67 (+415.38%)
Mutual labels:  multithreading, pipeline
java-multithread
Códigos feitos para o curso de Multithreading com Java, no canal RinaldoDev do YouTube.
Stars: ✭ 24 (+84.62%)
Mutual labels:  multithreading, parallel-processing
Hamsters.js
100% Vanilla Javascript Multithreading & Parallel Execution Library
Stars: ✭ 517 (+3876.92%)
Mutual labels:  multithreading, parallel-processing
Future
🚀 R package: future: Unified Parallel and Distributed Processing in R for Everyone
Stars: ✭ 735 (+5553.85%)
Mutual labels:  parallel-processing
Xnnpack
High-efficiency floating-point neural network inference operators for mobile, server, and Web
Stars: ✭ 808 (+6115.38%)
Mutual labels:  multithreading
Segmentation
Catalyst.Segmentation
Stars: ✭ 27 (+107.69%)
Mutual labels:  pipeline
Lib
single header libraries for C/C++
Stars: ✭ 866 (+6561.54%)
Mutual labels:  multithreading
Toil
A scalable, efficient, cross-platform (Linux/macOS) and easy-to-use workflow engine in pure Python.
Stars: ✭ 733 (+5538.46%)
Mutual labels:  pipeline
Vector
A reliable, high-performance tool for building observability data pipelines.
Stars: ✭ 8,736 (+67100%)
Mutual labels:  pipeline
Jpegrtspcamera
Sample RTSP server streaming MJPEG video from PC camera
Stars: ✭ 25 (+92.31%)
Mutual labels:  multithreading
Vertx Embedded Springboot
Vert.x embeded Springboot
Stars: ✭ 19 (+46.15%)
Mutual labels:  multithreading
Galaxy
Data intensive science for everyone.
Stars: ✭ 812 (+6146.15%)
Mutual labels:  pipeline
Worker Threads Nodejs
Benchmark nodeJS worker threads for calculating prime numbers, using various dataStructures
Stars: ✭ 27 (+107.69%)
Mutual labels:  multithreading
Interlace
Easily turn single threaded command line applications into a fast, multi-threaded application with CIDR and glob support.
Stars: ✭ 760 (+5746.15%)
Mutual labels:  multithreading
Brunch
🍴 Web applications made easy. Since 2011.
Stars: ✭ 6,801 (+52215.38%)
Mutual labels:  pipeline
Pipeline
A cloud-native Pipeline resource.
Stars: ✭ 6,751 (+51830.77%)
Mutual labels:  pipeline
Puma
A Ruby/Rack web server built for parallelism
Stars: ✭ 6,924 (+53161.54%)
Mutual labels:  multithreading
Cookiecutter
DEPRECIATED! Please use nf-core/tools instead
Stars: ✭ 18 (+38.46%)
Mutual labels:  pipeline
Phila Airflow
Stars: ✭ 16 (+23.08%)
Mutual labels:  pipeline
Elixir Paratize
Elixir library providing some handy parallel processing facilities that supports configuring number of workers and timeout.
Stars: ✭ 25 (+92.31%)
Mutual labels:  parallel-processing

ppipe

An elegantly simple and lightweight Rust library for making iterator pipelines concurrent and amazingly fast, hence the name "ppipe" (parallel pipe). Find it here: https://crates.io/crates/ppipe

Usage

Put this in your Cargo.toml:

[dependencies]

ppipe = "0.2.0"

Then add this to your root module:

extern crate ppipe;

And add this to whatever module you want to be able to use ppipe:

use ppipe::*;

Now generally all iterators in scope should have the ppipe method!

Overview

If you followed the above steps, every iterator should have the ppipe method. The method takes an Option<usize> parameter which can be used to declare if you want back-pressure or not. ppipe(Some(1000)) would mean that you want the concurrent receiver to hold no more than 1000 values and tell the sender to block until the receiver's buffer goes below 1000 over the course of, for example, a for loop.

Example

extern crate ppipe;
use ppipe::*;

// ...

for item in excel_sheet.into_iter()
  .map(do_something)
  .write_out_err(some_err_handling_func)
  .ppipe(None)  // create a thread for the above work
  .map(do_something_else)
  .ppipe(None) // create another thread for the the above work
  // ...
{
  // ...
}

How It Works Internally

The significance of this little library is hard to put into words, so please refer to the ppipe_example.rs in the examples folder of this repository, which I will reference in this explanation.

The point of this simplistic example is to demonstrate how WITHOUT ppipe, every iteration moves the corresponding item along the pipeline and then executes, in this case, the for loop's body. The items are never pre-loaded into some buffer waiting for the iteration variable to take ownership after being forced to move along the pipeline. This is almost never idealistic; why limit yourself to serial processing when you have Rust's powerful parallel processing at hand? This is what ppipe does. WITH ppipe, all previous iterator adaptors are ran regardless of what iteration, in this case, the for loop is on, including any previous ppipe adaptors which are busy doing their own thing. Every item that is processed is put in a buffer which can be accessed as it is being added to, and if there are no items in the buffer, the iteration will simply block until an item is available, or break if there are no more items being processed. This means items can be added to the buffer as you are iterating over previous items in the buffer, which ultimately reduces bottlenecking and GREATLY increases performance!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].