Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sourcemap feature #372

Merged

Conversation

chinedufn
Copy link
Contributor

This commit introduces the "sourcemap" feature.

Users that do not need sourcemaps can disable this feature and save
roughly 15% on compile times.

Related to #357

@chinedufn
Copy link
Contributor Author

chinedufn commented Dec 28, 2022

Seeing around 15% savings in compile times on my machine when running cargo clean && cargo build --no-default-features --features grid --timings.

This PR gets rkyv out of the dependency tree for those that aren't using sourcemaps.
syn is still in there but future PRs will try to chip away at that.

Before

Around 43 seconds (consistent over a few runs)

image

After

Around 36 seconds (consistent over a few runs)

image

@@ -233,7 +235,12 @@ where
let project_root = options.project_root.clone();
let mut printer = Printer::new(&mut dest, options);

printer.sources = Some(&self.sources);
#[cfg(feature = "sourcemap")]
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conditionally compiling expressions isn't stable, so needed to wrap this in a block.

Cargo.toml Outdated
@@ -29,12 +29,13 @@ crate-type = ["rlib"]
[features]
default = ["bundler", "grid", "nodejs"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should probably add "sourcemap" to the default features. I guess the node bindings are getting it through "bundler" right now, though they kinda use it directly too even without the bundler.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok great. Just force pushed a commit with sourcemap as an explicitly default feature

This commit introduces the "sourcemap" feature.

Users that do not need sourcemaps can disable this feature and save
roughly 15% on compile times.

Related to parcel-bundler#357
Copy link
Member

@devongovett devongovett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@devongovett devongovett merged commit f4bf515 into parcel-bundler:master Dec 29, 2022
@chinedufn chinedufn deleted the feature-flag-sourcemaps branch December 30, 2022 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants