Skip to content

Commit

Permalink
Update guide/src/parallelism.md
Browse files Browse the repository at this point in the history
Co-authored-by: Yuji Kanagawa <[email protected]>
  • Loading branch information
davidhewitt and kngwyu authored Mar 17, 2021
1 parent 4d2913d commit 971b48f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion guide/src/parallelism.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

CPython has the infamous [Global Interpreter Lock](https://docs.python.org/3/glossary.html#term-global-interpreter-lock), which prevents several threads from executing Python bytecode in parallel. This makes threading in Python a bad fit for [CPU-bound](https://stackoverflow.com/questions/868568/) tasks and often forces developers to accept the overhead of multiprocessing.

In PyO3 parallelism can be easily achieved in Rust-only code. Let's take a look at our [word-count](https://github.com/PyO3/pyo3/blob/main/examples/word-count/src/lib.rs) example, where we have a `search` function that utilizes the [rayon](https://github.com/nikomatsakis/rayon) crate to count words in parallel.
In PyO3 parallelism can be easily achieved in Rust-only code. Let's take a look at our [word-count](https://github.com/PyO3/pyo3/blob/main/examples/word-count/src/lib.rs) example, where we have a `search` function that utilizes the [rayon](https://github.com/rayon-rs/rayon) crate to count words in parallel.
```rust, ignore
#[pyfunction]
fn search(contents: &str, needle: &str) -> usize {
Expand Down

0 comments on commit 971b48f

Please sign in to comment.