Skip to content

Add sourcemap feature#372

Merged
devongovett merged 1 commit intoparcel-bundler:masterfrom
chinedufn:feature-flag-sourcemaps
Dec 29, 2022
Merged

Add sourcemap feature#372
devongovett merged 1 commit intoparcel-bundler:masterfrom
chinedufn:feature-flag-sourcemaps

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

@chinedufn chinedufn force-pushed the feature-flag-sourcemaps branch from 1aa56ac to dab1a3b Compare December 28, 2022 14:05

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
@chinedufn chinedufn force-pushed the feature-flag-sourcemaps branch from dab1a3b to 5313652 Compare December 29, 2022 19:00
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.

2 participants