perf: Rust 1.95's APIs where they measure better, with every seeded result unchanged - #424
Merged
Merged
Conversation
ln's and exp's special cases, a NaN constraint violation, a pivot that isn't positive in the Cholesky factorization, and the NaN checks of L-BFGS-B's projected gradient and Nelder-Mead's mirroring. Measured site by site in instruction counts: ln's lowers DE's and CMA-ES's generations; the others are unchanged. Lemire's rejection in below_u64, a NaN score in Fitness::try_new and a skipped L-BFGS-B pair were left out: each made some benchmarks cost more.
…exing Rosenbrock, Dixon-Price, Trid, the two penalized functions, Schaffer F7, Kursawe and the CLI's Rosenbrock, the analytic gradients, NSGA-II's crowding distance, the network's parameter count, the check for a repeated variable name, and the tests' Rosenbrock helpers: the same float operations in the same order.
The loops index slices resliced to n first, so the compiler can drop the bounds checks; the operations and their order are unchanged.
…'s panels The panels of MR rows are written through fixed-size column chunks, whose index is known to be in bounds; the same copies in the same order. The packed column tiles of the Cholesky update stay as they were: written the same way, they cost more.
An expectation that turns out unfulfilled is a warning, so a lint allowed for no reason shows. The dead_code allows of the Cholesky factorization and the triangular solves, both used by L-BFGS-B, and a type_complexity allow in the Python package were stale: removed. The linear algebra's other dead code is used by the tests only, so its expectations hold outside them.
…ce of the take helper The fields of a checkpoint are cut off the front of the bytes with <[T]>::split_off and the fixed-size lengths read as arrays; the checksum is the last chunk of 8 bytes.
The low and high halves of the 128-bit product, without the u128 casts.
The same k as the float square root for every size up to 2^28, far above what SPEA2 allows.
The OpenEs population size check, the even-parity table, WFG2's intervals, the double factorial series, the Büche-Rastrigin function and its gradient, the hypervolume's inclusion-exclusion sign, and the Python WFG check.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The follow-up to #402 and #422: the APIs that Rust 1.95 allows, plus the older ones #402 listed as "usable now". One topic per commit, each measured in instruction counts against its parent. Every seeded result is identical to the bit:
portable_runs, the linalg fixed-bit tests, and all 223 examples against theiroutput.txt.Instruction counts, this branch against main (valgrind, gungraun 0.19.4, Rust 1.99, one codegen unit). No benchmark gained.
Kept:
core::hint::cold_path(1.95) onln's special cases, the source of the CMA-ES and DE gains, and onexp, a NaN violation, the Cholesky pivot, L-BFGS-B's projected gradient and Nelder-Mead's mirror.array_windows(1.94) in Rosenbrock, Dixon-Price, Trid, Penalized 1 and 2, Schaffer F7, Kursawe, the gradients, the crowding distance,nnand more. The same float operations, in the same order.gemvand in L-BFGS-B's O(n) loops, which removes their bounds checks. This is the −4.94%.as_chunks_mutin gemm's A panel and in the Cholesky update's panel.#[expect]in place of#[allow]. This removed the staledead_codeallows ofcholeskyandtriangular, which L-BFGS-B uses now, and a staletype_complexity.split_off,split_last_chunkandas_arrayin checkpoints;carrying_mulinbelow_u64;isqrtin SPEA2 (the same k for every n up to 2^28);is_multiple_of.Dropped, measured:
cold_pathinbelow_u64: tournament selection −2.9%, but DE +1.6%.cold_pathinFitness::try_new: the fitness loop −8.5%, but the OneMax run +1.45%.cold_pathon L-BFGS-B's skipped pair: a small cost.as_chunks_mutfor the Cholesky column tiles: +0.87%.f64::midpointin DE: identical to the bit over 200M pairs and every class of f64, but DE +0.39%.Not adopted:
cfg_select!. rustfmt doesn't format inside it, and the paired functions read no better wrapped in it.