Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
Use web_time crate instead of std::time (0xPolygonZero#1481)
Browse files Browse the repository at this point in the history
  • Loading branch information
vivekvpandya authored Jan 25, 2024
1 parent eff7cc0 commit 14bb5bd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
3 changes: 2 additions & 1 deletion plonky2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ default = ["gate_testing", "parallel", "rand_chacha", "std", "timing"]
gate_testing = []
parallel = ["hashbrown/rayon", "plonky2_maybe_rayon/parallel"]
std = ["anyhow/std", "rand/std", "itertools/use_std"]
timing = ["std"]
timing = ["std", "dep:web-time"]

[dependencies]
ahash = { version = "0.8.3", default-features = false, features = ["compile-time-rng"] } # NOTE: Be sure to keep this version the same as the dependency in `hashbrown`.
Expand All @@ -34,6 +34,7 @@ serde = { version = "1.0", default-features = false, features = ["derive", "rc"]
serde_json = "1.0"
static_assertions = { version = "1.1.0", default-features = false }
unroll = { version = "0.1.5", default-features = false }
web-time = { version = "1.0.0", optional = true }

[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
getrandom = { version = "0.2", default-features = false, features = ["js"] }
Expand Down
4 changes: 2 additions & 2 deletions plonky2/src/fri/reduction_strategies.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use alloc::vec;
use alloc::vec::Vec;
#[cfg(feature = "timing")]
use std::time::Instant;

use log::debug;
use serde::Serialize;
#[cfg(feature = "timing")]
use web_time::Instant;

/// A method for deciding what arity to use at each reduction layer.
#[derive(Debug, Clone, Eq, PartialEq, Serialize)]
Expand Down
5 changes: 2 additions & 3 deletions plonky2/src/util/timing.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#[cfg(feature = "timing")]
use std::time::{Duration, Instant};

use log::{log, Level};
#[cfg(feature = "timing")]
use web_time::{Duration, Instant};

/// The hierarchy of scopes, and the time consumed by each one. Useful for profiling.
#[cfg(feature = "timing")]
Expand Down

0 comments on commit 14bb5bd

Please sign in to comment.