Skip to content

Commit 191ade2

Browse files
committed
Remove the semi-secret logging
Rayon has long had some logging functionality, but not well advertised. The only mention is in the (private) module docs: > To use in a debug build, set the env var `RAYON_LOG` as > described below. In a release build, logs are compiled out by > default unless Rayon is built with `--cfg rayon_rs_log` (try > `RUSTFLAGS="--cfg rayon_rs_log"`). > > Note that logs are an internally debugging tool and their format > is considered unstable, as are the details of how to enable them. I, for one, have not "internally" used this for debugging at all, yet it comes at some cost to all users, even disabled in release builds. At the very least it requires `crossbeam-channel` that we're not using anywhere else except tests. Besides that, this code also bloats the compiled size of `rayon-core` by about 30%, and similar for its compile time. **So let's just rip out the logger!** The remaining uses of `crossbeam-channel` in test cases are easily avoidable too, since `std::sync::mpsc::Sender` is now `Sync`.
1 parent 43868a3 commit 191ade2

File tree

9 files changed

+34
-582
lines changed

9 files changed

+34
-582
lines changed

ci/compat-Cargo.lock

Lines changed: 0 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rayon-core/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ categories = ["concurrency"]
1717

1818
# Some dependencies may not be their latest version, in order to support older rustc.
1919
[dependencies]
20-
crossbeam-channel = "0.5.0"
2120
crossbeam-deque = "0.8.1"
2221
crossbeam-utils = "0.8.0"
2322

rayon-core/src/broadcast/test.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
use crate::ThreadPoolBuilder;
44
use std::sync::atomic::{AtomicUsize, Ordering};
5+
use std::sync::mpsc::channel;
56
use std::sync::Arc;
67
use std::{thread, time};
78

@@ -14,7 +15,7 @@ fn broadcast_global() {
1415
#[test]
1516
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
1617
fn spawn_broadcast_global() {
17-
let (tx, rx) = crossbeam_channel::unbounded();
18+
let (tx, rx) = channel();
1819
crate::spawn_broadcast(move |ctx| tx.send(ctx.index()).unwrap());
1920

2021
let mut v: Vec<_> = rx.into_iter().collect();
@@ -33,7 +34,7 @@ fn broadcast_pool() {
3334
#[test]
3435
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
3536
fn spawn_broadcast_pool() {
36-
let (tx, rx) = crossbeam_channel::unbounded();
37+
let (tx, rx) = channel();
3738
let pool = ThreadPoolBuilder::new().num_threads(7).build().unwrap();
3839
pool.spawn_broadcast(move |ctx| tx.send(ctx.index()).unwrap());
3940

@@ -53,7 +54,7 @@ fn broadcast_self() {
5354
#[test]
5455
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
5556
fn spawn_broadcast_self() {
56-
let (tx, rx) = crossbeam_channel::unbounded();
57+
let (tx, rx) = channel();
5758
let pool = ThreadPoolBuilder::new().num_threads(7).build().unwrap();
5859
pool.spawn(|| crate::spawn_broadcast(move |ctx| tx.send(ctx.index()).unwrap()));
5960

@@ -81,7 +82,7 @@ fn broadcast_mutual() {
8182
#[test]
8283
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
8384
fn spawn_broadcast_mutual() {
84-
let (tx, rx) = crossbeam_channel::unbounded();
85+
let (tx, rx) = channel();
8586
let pool1 = Arc::new(ThreadPoolBuilder::new().num_threads(3).build().unwrap());
8687
let pool2 = ThreadPoolBuilder::new().num_threads(7).build().unwrap();
8788
pool1.spawn({
@@ -118,7 +119,7 @@ fn broadcast_mutual_sleepy() {
118119
#[test]
119120
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
120121
fn spawn_broadcast_mutual_sleepy() {
121-
let (tx, rx) = crossbeam_channel::unbounded();
122+
let (tx, rx) = channel();
122123
let pool1 = Arc::new(ThreadPoolBuilder::new().num_threads(3).build().unwrap());
123124
let pool2 = ThreadPoolBuilder::new().num_threads(7).build().unwrap();
124125
pool1.spawn({
@@ -158,8 +159,8 @@ fn broadcast_panic_one() {
158159
#[test]
159160
#[cfg_attr(not(panic = "unwind"), ignore)]
160161
fn spawn_broadcast_panic_one() {
161-
let (tx, rx) = crossbeam_channel::unbounded();
162-
let (panic_tx, panic_rx) = crossbeam_channel::unbounded();
162+
let (tx, rx) = channel();
163+
let (panic_tx, panic_rx) = channel();
163164
let pool = ThreadPoolBuilder::new()
164165
.num_threads(7)
165166
.panic_handler(move |e| panic_tx.send(e).unwrap())
@@ -196,8 +197,8 @@ fn broadcast_panic_many() {
196197
#[test]
197198
#[cfg_attr(not(panic = "unwind"), ignore)]
198199
fn spawn_broadcast_panic_many() {
199-
let (tx, rx) = crossbeam_channel::unbounded();
200-
let (panic_tx, panic_rx) = crossbeam_channel::unbounded();
200+
let (tx, rx) = channel();
201+
let (panic_tx, panic_rx) = channel();
201202
let pool = ThreadPoolBuilder::new()
202203
.num_threads(7)
203204
.panic_handler(move |e| panic_tx.send(e).unwrap())
@@ -231,7 +232,7 @@ fn broadcast_sleep_race() {
231232

232233
#[test]
233234
fn broadcast_after_spawn_broadcast() {
234-
let (tx, rx) = crossbeam_channel::unbounded();
235+
let (tx, rx) = channel();
235236

236237
// Queue a non-blocking spawn_broadcast.
237238
crate::spawn_broadcast(move |ctx| tx.send(ctx.index()).unwrap());
@@ -247,7 +248,7 @@ fn broadcast_after_spawn_broadcast() {
247248

248249
#[test]
249250
fn broadcast_after_spawn() {
250-
let (tx, rx) = crossbeam_channel::bounded(1);
251+
let (tx, rx) = channel();
251252

252253
// Queue a regular spawn on a thread-local deque.
253254
crate::registry::in_worker(move |_, _| {

rayon-core/src/latch.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,6 @@ impl CoreLatch {
8484
}
8585
}
8686

87-
/// Returns the address of this core latch as an integer. Used
88-
/// for logging.
89-
#[inline]
90-
pub(super) fn addr(&self) -> usize {
91-
self as *const CoreLatch as usize
92-
}
93-
9487
/// Invoked by owning thread as it prepares to sleep. Returns true
9588
/// if the owning thread may proceed to fall asleep, false if the
9689
/// latch was set in the meantime.

rayon-core/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ use std::marker::PhantomData;
7575
use std::str::FromStr;
7676
use std::thread;
7777

78-
#[macro_use]
79-
mod log;
8078
#[macro_use]
8179
mod private;
8280

0 commit comments

Comments
 (0)