Skip to content

Commit 23e8640

Browse files
authored
perf: Make page static info use Atom instead of String (#75596)
### What? Use `swc_atoms::Atom` instead of `String` in `next-swc`. ### Why? `Atom` does not allocate if another instance has the same value, meaning that `clone()` is a single atomic operation. But `String` allocates regardless of any other occurrence.
1 parent 05b9184 commit 23e8640

File tree

1 file changed

+3
-3
lines changed
  • crates/next-custom-transforms/src/transforms/page_static_info

1 file changed

+3
-3
lines changed

crates/next-custom-transforms/src/transforms/page_static_info/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ pub enum Amp {
2828
pub struct PageStaticInfo {
2929
// [TODO] next-core have NextRuntime type, but the order of dependency won't allow to import
3030
// Since this value is being passed into JS context anyway, we can just use string for now.
31-
pub runtime: Option<String>, // 'nodejs' | 'experimental-edge' | 'edge'
32-
pub preferred_region: Vec<String>,
31+
pub runtime: Option<Atom>, // 'nodejs' | 'experimental-edge' | 'edge'
32+
pub preferred_region: Vec<Atom>,
3333
pub ssg: Option<bool>,
3434
pub ssr: Option<bool>,
35-
pub rsc: Option<String>, // 'server' | 'client'
35+
pub rsc: Option<Atom>, // 'server' | 'client'
3636
pub generate_static_params: Option<bool>,
3737
pub middleware: Option<MiddlewareConfig>,
3838
pub amp: Option<Amp>,

0 commit comments

Comments
 (0)