mirror of
https://github.com/arnaucube/hyperplonk.git
synced 2026-01-10 16:11:29 +01:00
enabling batch opening and mock tests (#80)
- add mock circuits - add vanilla and jellyfish plonk gates - performance tuning
This commit is contained in:
13
util/Cargo.toml
Normal file
13
util/Cargo.toml
Normal file
@@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "util"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
rayon = { version = "1.5.0", optional = true }
|
||||
|
||||
[features]
|
||||
default = []
|
||||
parallel = [ "rayon" ]
|
||||
29
util/src/lib.rs
Normal file
29
util/src/lib.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright (c) 2022 Espresso Systems (espressosys.com)
|
||||
// This file is part of the Jellyfish library.
|
||||
// You should have received a copy of the MIT License
|
||||
// along with the Jellyfish library. If not, see <https://mit-license.org/>.
|
||||
|
||||
//! Utilities for parallel code.
|
||||
|
||||
/// this function helps with slice iterator creation that optionally use
|
||||
/// `par_iter()` when feature flag `parallel` is on.
|
||||
///
|
||||
/// # Usage
|
||||
/// let v = [1, 2, 3, 4, 5];
|
||||
/// let sum = parallelizable_slice_iter(&v).sum();
|
||||
///
|
||||
/// // the above code is a shorthand for (thus equivalent to)
|
||||
/// #[cfg(feature = "parallel")]
|
||||
/// let sum = v.par_iter().sum();
|
||||
/// #[cfg(not(feature = "parallel"))]
|
||||
/// let sum = v.iter().sum();
|
||||
#[cfg(feature = "parallel")]
|
||||
pub fn parallelizable_slice_iter<T: Sync>(data: &[T]) -> rayon::slice::Iter<T> {
|
||||
use rayon::iter::IntoParallelIterator;
|
||||
data.into_par_iter()
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "parallel"))]
|
||||
pub fn parallelizable_slice_iter<T>(data: &[T]) -> core::slice::Iter<T> {
|
||||
data.iter()
|
||||
}
|
||||
Reference in New Issue
Block a user