Skip to content

Commit

Permalink
rolldown{bench,testing,tracing}
Browse files Browse the repository at this point in the history
  • Loading branch information
topheman committed Oct 26, 2024
1 parent c4f5090 commit 81508f1
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- [rolldown / Builtin Plugins](./rolldown/explore-plugins.md)
- [rolldown / rolldown](./rolldown/explore-root.md)
- [rolldown / Build](./rolldown/build.md)
- [rolldown / Bench](./rolldown/bench.md)

# oxc

Expand Down
4 changes: 2 additions & 2 deletions src/oxc/explore.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

## oxc_codegen

See more about sourcemaps on [oxc::oxc_sourcemaps](#oxc_sourcemap).
See more about sourcemaps on [`oxc::oxc_sourcemaps`](#oxc_sourcemap).

<a href="https://github.com/oxc-project/oxc/blob/main/crates/oxc_codegen/src/lib.rs" title="Source Code of oxc_codegen">📄</a>

## oxc_sourcemap

> The sourcemap implement port from [rust-sourcemap](https://github.com/getsentry/rust-sourcemap), but has some different with it.
> The sourcemap implement port from [`rust-sourcemap`](https://github.com/getsentry/rust-sourcemap), but has some different with it.
>
> Encode sourcemap at parallel, including quote sourceContent and encode token to vlq mappings.
> Avoid Sourcemap some methods overhead, like SourceMap::tokens().
Expand Down
2 changes: 2 additions & 0 deletions src/rolldown/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# rolldown / Introduction

<https://github.com/rolldown/rolldown>

<https://rolldown.rs/contrib-guide>
13 changes: 13 additions & 0 deletions src/rolldown/bench.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# rolldown / bench

`just setup-bench` is already called with `just setup`.

There are benchmarks for:

- The rust part: [`crates/bench`](https://github.com/rolldown/rolldown/blob/main/crates/bench/Cargo.toml)
- `just bench-rust`: relies on [`cargo-bench`](https://doc.rust-lang.org/cargo/commands/cargo-bench.html)
- relies on the utils of [`rolldown_testing`](./explore-shared.md#rolldown_testing)
- The node part: [`packages/bench`](https://github.com/rolldown/rolldown/blob/main/packages/bench/benches/compare.js)
- `bench-node`: `pnpm --filter bench run bench`
- [`packages/bench/benches/par.js`](https://github.com/rolldown/rolldown/blob/main/packages/bench/benches/par.js)
- `bench-node-par`: `pnpm --filter bench exec node ./benches/par.js`
23 changes: 22 additions & 1 deletion src/rolldown/explore-shared.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Tiny wrapper around [lightningcss](https://lightningcss.dev)

## rolldown_ecmascript

- `oxc::allocator::Allocator` is needed for the parser - https://github.com/oxc-project/oxc/blob/main/crates/oxc_allocator/src/lib.rs
- `oxc::allocator::Allocator` is needed for the parser - <https://github.com/oxc-project/oxc/blob/main/crates/oxc_allocator/src/lib.rs>
- Oxc uses a bump-based memory arena for faster AST allocations - (example of bump alocator : [bumpalo](https://docs.rs/bumpalo/3.16.0/bumpalo/index.html))

<a href="https://github.com/rolldown/rolldown/tree/main/crates/rolldown_ecmascript" title="Source Code of rolldown_ecmascript">📄</a>
Expand Down Expand Up @@ -134,3 +134,24 @@ It collapses multiple sourcemaps generated by calls to `oxc::oxc_codegen::CodeGe
Relies on [`oxc::sourcemap::*`](https://github.com/oxc-project/oxc/tree/main/crates/oxc_sourcemap).

<a href="https://github.com/rolldown/rolldown/tree/main/crates/rolldown_sourcemap" title="Source Code of rolldown_sourcemap">📄</a>

## rolldown_testing

Utils for used for bench testing. Used for [benchmark](./bench.md).

<a href="https://github.com/rolldown/rolldown/tree/main/crates/rolldown_testing" title="Source Code of rolldown_testing">📄</a>

## rolldown_tracing

See [contribution guide chapter about tracing/logging](https://rolldown.rs/contrib-guide/tracing-logging).

This crate exposes [`try_init_tracing`](https://github.com/rolldown/rolldown/blob/main/crates/rolldown_tracing/src/lib.rs) which is called when building the bundler and correctly initializes tracing according to env vars.

[`rolldown_binding::bundler::Bundler`](https://github.com/rolldown/rolldown/blob/main/crates/rolldown_binding/src/bundler.rs) calls [`try_init_custom_trace_subscriber`](https://github.com/rolldown/rolldown/blob/main/crates/rolldown_binding/src/utils/mod.rs) which does the same as [`try_init_tracing`](https://github.com/rolldown/rolldown/blob/main/crates/rolldown_tracing/src/lib.rs) but ensures to call [`napi_env.add_env_cleanup_hook`](https://nodejs.org/api/n-api.html#napi_add_env_cleanup_hook) and manually `flush` and `drop` `tracing_chrome::FlushGuard`.

This crate relies on:

- [`tracing-chrome`](https://crates.io/crates/tracing-chrome)
- [`tracing-subscriber`](https://crates.io/crates/tracing-subscriber)

<a href="https://github.com/rolldown/rolldown/tree/main/crates/rolldown_tracing" title="Source Code of rolldown_tracing">📄</a>

0 comments on commit 81508f1

Please sign in to comment.