Skip to content

perf: the examples that sweep by hand solve their points side by side, through parallel::map_in_order - #151

Merged
tachsin merged 1 commit into
mainfrom
perf/example-sweeps
Oct 5, 2026
Merged

tachsin merged 1 commit into
mainfrom
perf/example-sweeps

Conversation

@tachsin

@tachsin tachsin commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Closes #137 (its jobs' half was #146).

What

  • photonoxide::parallel::map_in_order(items, f): f on each item side by side on rayon's threads, the results in the items' order, so a caller that prints or records them afterwards writes what a loop over them writes. A library helper, as the issue asked, rather than threading in each example: the studio builds the examples in and doesn't depend on rayon.
  • strip_waveguide (three grids), hadley_corners (four figures × five grids, both schemes) and group_index (five widths, each tracked over the wavelengths) solve their problems with it and then print in order. Their output is byte for byte examples/output/'s (checked for all three).

Measured

photonoxide bench example/... --threads 1,20, Core Ultra 7 265K, same session:

example 1 thread 20 threads, before 20 threads, after
hadley_corners 7.3 s 9.4 s 2.5 s
group_index 10.6 s 13.1 s 3.0 s
strip_waveguide 6.1 s 7.0 s 5.9 s (its 5 nm grid's solve alone)

Each used to be slower on 20 threads than on one. docs/benchmarks.md regenerated; ROADMAP ticks "Sweeps side by side".

Checked

  • parallel's test: results in order on 1, 3 and 8 threads; its doctest.
  • cargo test --release (361 passed), the studio's tests (35), clippy on both crates, rustdoc with -D warnings.

@tachsin tachsin added this to the 0.4.2 milestone Oct 5, 2026
@tachsin
tachsin merged commit 764efd5 into main Oct 5, 2026
10 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf: a sweep's points solved side by side, each on one thread (A1)

1 participant