Skip to content

Commit

Permalink
perf: remove module code generation result cache
Browse files Browse the repository at this point in the history
  • Loading branch information
h-a-n-a committed Dec 5, 2024
1 parent 29b77a1 commit 0d1d075
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions crates/rspack_core/src/concatenated_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ use rspack_collections::{
use rspack_error::{Diagnosable, Diagnostic, DiagnosticKind, Result, TraceableError};
use rspack_hash::{HashDigest, HashFunction, RspackHash};
use rspack_hook::define_hook;
use rspack_sources::{
CachedSource, ConcatSource, RawStringSource, ReplaceSource, Source, SourceExt,
};
use rspack_sources::{ConcatSource, RawSource, RawStringSource, ReplaceSource, Source, SourceExt};

Check failure on line 20 in crates/rspack_core/src/concatenated_module.rs

View workflow job for this annotation

GitHub Actions / Rust check

unused import: `RawSource`
use rspack_util::{ext::DynHash, itoa, source_map::SourceMapKind, swc::join_atom};
use rustc_hash::FxHasher;
use rustc_hash::{FxHashMap as HashMap, FxHashSet as HashSet};
Expand Down Expand Up @@ -1282,7 +1280,7 @@ impl Module for ConcatenatedModule {
}

let mut code_generation_result = CodeGenerationResult::default();
code_generation_result.add(SourceType::JavaScript, CachedSource::new(result).boxed());
code_generation_result.add(SourceType::JavaScript, result.boxed());
code_generation_result.chunk_init_fragments = chunk_init_fragments;
code_generation_result.runtime_requirements = runtime_requirements;
code_generation_result
Expand Down
4 changes: 2 additions & 2 deletions crates/rspack_core/src/normal_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use rspack_hook::define_hook;
use rspack_loader_runner::{run_loaders, AdditionalData, Content, LoaderContext, ResourceData};
use rspack_macros::impl_source_map_config;
use rspack_sources::{
BoxSource, CachedSource, OriginalSource, RawBufferSource, RawStringSource, Source, SourceExt,
BoxSource, OriginalSource, RawBufferSource, RawSource, RawStringSource, Source, SourceExt,

Check failure on line 21 in crates/rspack_core/src/normal_module.rs

View workflow job for this annotation

GitHub Actions / Rust check

unused import: `RawSource`
SourceMap, SourceMapSource, WithoutOriginalOptions,
};
use rspack_util::{
Expand Down Expand Up @@ -650,7 +650,7 @@ impl Module for NormalModule {
concatenation_scope: concatenation_scope.as_mut(),
},
)?;
code_generation_result.add(*source_type, CachedSource::new(generation_result).boxed());
code_generation_result.add(*source_type, generation_result.boxed());
}
code_generation_result.concatenation_scope = concatenation_scope;
Ok(code_generation_result)
Expand Down

0 comments on commit 0d1d075

Please sign in to comment.