mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 12:51:57 +00:00
Introduce new method `ConcatSourceMapBuilder::from_sourcemaps`.
Where all the sourcemaps being concatenated exist at time that you
create `ConcatSourceMapBuilder`, it's faster to use `from_sourcemaps`,
because it pre-allocates enough space for the data it will hold and so
avoids memory copying.
Before:
```rs
let mut builder = ConcatSourceMapBuilder::default();
builder.add_sourcemap(&sourcemap1, 0);
builder.add_sourcemap(&sourcemap2, 100);
builder.add_sourcemap(&sourcemap3, 100);
let combined = builder.into_sourcemap();
```
After:
```rs
let builder = ConcatSourceMapBuilder::from_sourcemaps(&[
(&sourcemap1, 0),
(&sourcemap2, 100),
(&sourcemap3, 200),
]);
let combined = builder.into_sourcemap();
```
|
||
|---|---|---|
| .. | ||
| codegen.rs | ||
| isolated_declarations.rs | ||
| lexer.rs | ||
| linter.rs | ||
| minifier.rs | ||
| parser.rs | ||
| parser_napi.rs | ||
| prettier.rs | ||
| semantic.rs | ||
| sourcemap.rs | ||
| transformer.rs | ||