Skip to content

Commit

Permalink
perf: reduce Module size (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
underfin authored Sep 19, 2023
1 parent 8e79599 commit b1ceb65
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions crates/rolldown/src/bundler/module/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use super::{external_module::ExternalModule, render::RenderModuleContext, Normal

#[derive(Debug)]
pub enum Module {
Normal(NormalModule),
External(ExternalModule),
Normal(Box<NormalModule>),
External(Box<ExternalModule>),
}

impl Module {
Expand Down
4 changes: 2 additions & 2 deletions crates/rolldown/src/bundler/module_loader/module_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl<'a> ModuleLoader<'a> {
while tables.len() <= task_result.module_id.raw() as usize {
tables.push(Default::default());
}
intermediate_modules[module_id] = Some(Module::Normal(builder.build()));
intermediate_modules[module_id] = Some(Module::Normal(Box::new(builder.build())));

tables[task_result.module_id] = symbol_table
}
Expand Down Expand Up @@ -151,7 +151,7 @@ impl<'a> ModuleLoader<'a> {
id,
ResourceId::new(info.path.clone(), &self.input_options.cwd),
);
intermediate_modules[id] = Some(Module::External(ext));
intermediate_modules[id] = Some(Module::External(Box::new(ext)));
} else {
not_visited.insert(id);

Expand Down

0 comments on commit b1ceb65

Please sign in to comment.