about summary refs log tree commit diff
path: root/tests/rustdoc-js-std/parser-slice-array.js
diff options
context:
space:
mode:
authorTimo <30553356+y21@users.noreply.github.com>2025-06-20 21:58:45 +0000
committerGitHub <noreply@github.com>2025-06-20 21:58:45 +0000
commit98555244f05499b1cad768713da9a10d80992964 (patch)
treefa3948b48d69dee9433e89cf41444769e1d12349 /tests/rustdoc-js-std/parser-slice-array.js
parent0601337a256cd2afc7208ff6c1009386fbec893b (diff)
parent3745a3f7ab1438ebc35836405c3b4f23bd6262a6 (diff)
downloadrust-98555244f05499b1cad768713da9a10d80992964.tar.gz
rust-98555244f05499b1cad768713da9a10d80992964.zip
[PERF] Don't spawn so many compilers (3/2) (19m -> 250k) (#15030)
Optimize `needless_doctest_main`, make it short-circuit, make sure that
we don't spin up a new compiler on EVERY code block.

---

The old implementation was creating a new compiler, new parser, new
thread, new SessionGlobals, new everything for each code block. No
matter if they actually didn't even contain `fn main()` or anything
relevant.

On callgrind, seems that we're reducing about a 6.7242% de cycle count
(which turns out to be a 38 million instruction difference, great!).
Benchmarked in `bumpalo-3.16.0`. Also on bumpalo we spawn 78 less
threads. This moves `SessionGlobals::new` from the top time-consuming
function by itself in some benchmarks, into one not even in the top 500.

Also, populate the test files.

changelog:[`needless_doctest_main`]: Avoid spawning so many threads in
unnecessary circumstances
Diffstat (limited to 'tests/rustdoc-js-std/parser-slice-array.js')
0 files changed, 0 insertions, 0 deletions