perf(es/codegen): Use Vec<T> from swc_allocator (#9280)
Some checks are pending
CI / Cargo fmt (push) Waiting to run
CI / Cargo clippy (push) Waiting to run
CI / Check license of dependencies (push) Waiting to run
CI / Check (macos-latest) (push) Waiting to run
CI / Check (ubuntu-latest) (push) Waiting to run
CI / Check (windows-latest) (push) Waiting to run
CI / Test wasm (binding_core_wasm) (push) Waiting to run
CI / Test wasm (binding_minifier_wasm) (push) Waiting to run
CI / Test wasm (binding_typescript_wasm) (push) Waiting to run
CI / List crates (push) Waiting to run
CI / Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} (push) Blocked by required conditions
CI / Test node bindings - ${{ matrix.os }} (macos-latest) (push) Waiting to run
CI / Test node bindings - ${{ matrix.os }} (windows-latest) (push) Waiting to run
CI / Test with @swc/cli (push) Waiting to run
CI / Miri (better_scoped_tls) (push) Waiting to run
CI / Miri (string_enum) (push) Waiting to run
CI / Miri (swc) (push) Waiting to run
CI / Miri (swc_bundler) (push) Waiting to run
CI / Miri (swc_ecma_codegen) (push) Waiting to run
CI / Miri (swc_ecma_minifier) (push) Waiting to run
CI / Done (push) Blocked by required conditions
Benchmark / Bench everything (push) Waiting to run

This commit is contained in:
Donny/강동윤 2024-07-19 19:27:32 +09:00 committed by GitHub
parent 33284c128e
commit c1cd0b99c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,8 @@
---
swc_compiler_base: patch
swc_ecma_codegen: patch
swc_ecma_transforms_react: patch
swc_fast_ts_strip: patch
---
perf(es/codegen): Use `Vec<T>` from `swc_allocator`

View File

@ -9,6 +9,7 @@ use once_cell::sync::Lazy;
use rustc_hash::FxHashMap;
#[allow(unused)]
use serde::{Deserialize, Serialize};
use swc_allocator::maybe::vec::Vec;
use swc_atoms::JsWord;
use swc_common::{
collections::AHashMap,

View File

@ -37,6 +37,7 @@ codspeed-criterion-compat = { workspace = true }
criterion = { workspace = true }
serde_json = { workspace = true }
swc_allocator = { version = "0.1.7", path = "../swc_allocator" }
swc_common = { version = "0.36.0", path = "../swc_common", features = [
"sourcemap",
] }

View File

@ -1,6 +1,7 @@
extern crate swc_malloc;
use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Bencher, Criterion};
use swc_allocator::{maybe::vec::Vec, Allocator};
use swc_common::FileName;
use swc_ecma_codegen::Emitter;
use swc_ecma_parser::{Parser, StringInput, Syntax};
@ -94,6 +95,9 @@ fn bench_emitter(b: &mut Bencher, s: &str) {
}
b.iter(|| {
let alloc = Allocator::default();
let mut _guard = unsafe { alloc.guard() };
let mut src_map_buf = Vec::new();
let mut buf = Vec::new();
{

View File

@ -1,6 +1,7 @@
extern crate swc_malloc;
use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Bencher, Criterion};
use swc_allocator::maybe::vec::Vec;
use swc_common::FileName;
use swc_ecma_codegen::Emitter;
use swc_ecma_parser::{Parser, StringInput, Syntax};

View File

@ -9,6 +9,7 @@ use std::{
time::Instant,
};
use swc_allocator::maybe::vec::Vec;
use swc_common::input::SourceFileInput;
use swc_ecma_ast::*;
use swc_ecma_codegen::{text_writer::JsWriter, Emitter};

View File

@ -1,6 +1,7 @@
use std::io::Write;
use rustc_hash::FxHashSet;
use swc_allocator::maybe::vec::Vec;
use swc_common::{sync::Lrc, BytePos, LineCol, SourceMap, Span};
use super::{Result, WriteJs};

View File

@ -3,6 +3,7 @@ use std::{fs::read_to_string, path::PathBuf};
use base64::prelude::{Engine, BASE64_STANDARD};
use rustc_hash::FxHashSet;
use sourcemap::SourceMap;
use swc_allocator::maybe::vec::Vec;
use swc_common::{comments::SingleThreadedComments, source_map::SourceMapGenConfig};
use swc_ecma_ast::EsVersion;
use swc_ecma_codegen::{text_writer::WriteJs, Emitter};

View File

@ -1,3 +1,4 @@
use swc_allocator::maybe::vec::Vec;
use swc_common::{comments::SingleThreadedComments, sync::Lrc, FileName, Mark, SourceMap};
use swc_ecma_codegen::{text_writer::JsWriter, Emitter};
use swc_ecma_parser::{Parser, StringInput};

View File

@ -2,6 +2,7 @@ use std::{cell::RefCell, rc::Rc};
use anyhow::{Context, Error};
use serde::{Deserialize, Serialize};
use swc_allocator::maybe::vec::Vec;
use swc_common::{
comments::SingleThreadedComments,
errors::{Handler, HANDLER},