Skip to content

Commit

Permalink
reduce memory usage in analyser (#8061)
Browse files Browse the repository at this point in the history
### Description


* reduce JSValue size by 40 bytes (from 88 bytes)

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->


Closes PACK-3029
  • Loading branch information
sokra committed May 7, 2024
1 parent b183920 commit 9de8fd5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/turbopack-ecmascript/src/analyzer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ pub enum JsValue {
/// A constant primitive value.
Constant(ConstantValue),
/// An constant URL object.
Url(Url),
Url(Box<Url>),
/// Some kind of well-known object
/// (must not be an array, otherwise Array.concat needs to be changed)
WellKnownObject(WellKnownObjectKind),
Expand Down
1 change: 1 addition & 0 deletions crates/turbopack-ecmascript/src/analyzer/well_known.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ pub fn path_to_file_url(args: Vec<JsValue>) -> JsValue {
if args.len() == 1 {
if let Some(path) = args[0].as_str() {
Url::from_file_path(path)
.map(Box::new)
.map(JsValue::Url)
.unwrap_or_else(|_| {
JsValue::unknown(
Expand Down

0 comments on commit 9de8fd5

Please sign in to comment.