Skip to content

Make serde dependency optional - #235

Merged
bors-servo merged 1 commit into
servo:masterfrom
thomcc:optional-serde
Dec 5, 2019
Merged

bors-servo merged 1 commit into
servo:masterfrom
thomcc:optional-serde

Conversation

@thomcc

@thomcc thomcc commented Dec 5, 2019

Copy link
Copy Markdown

This crate (and deps) takes around 8s to compile on my machine. I checked and this is mostly serde, and without it, a full rebuild takes only 0.5s (again, on my machine).

Many users of the crate will need serde, but some will not (e.g. I don't), and it's nice to get that compile time back for those that don't. It's on by default, for compatibility reasons, because default seems reasonable, and because I don't really care so long as I can disable it.

I've named the feature serde_support instead of just serde in case you ever need to enable other crates or dep feature based on this (but perhaps I'm wrong and this would be possible anyway).

I have tested locally, and added a CI smoke test to ensure it compiles without serde, but we don't run tests with out it (there are no serde-specific tests AFAICT, since the impls are indeed trivial, so the result would be the same anyway).

@jdm

jdm commented Dec 5, 2019

Copy link
Copy Markdown
Member

@bors-servo r+
Looks good; thanks!

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 7f50fe0 has been approved by jdm

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 7f50fe0 with merge af2c770...

bors-servo pushed a commit that referenced this pull request Dec 5, 2019
Make serde dependency optional

This crate (and deps) takes around 8s to compile on my machine. I checked and this is mostly serde, and without it, a full rebuild takes only 0.5s (again, on my machine).

Many users of the crate will need serde, but some will not (e.g. I don't), and it's nice to get that compile time back for those that don't. It's on by default, for compatibility reasons, because default seems reasonable, and because I don't really care so long as I can disable it.

I've named the feature `serde_support` instead of just `serde` in case you ever need to enable other crates or dep feature based on this (but perhaps I'm wrong and this would be possible anyway).

I have tested locally, and added a CI smoke test to ensure it compiles without serde, but we don't run tests with out it (there are no serde-specific tests AFAICT, since the impls are indeed trivial, so the result would be the same anyway).
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - checks-travis
Approved by: jdm
Pushing af2c770 to master...

@bors-servo
bors-servo merged commit 7f50fe0 into servo:master Dec 5, 2019
@mvtec-bergdolll

mvtec-bergdolll commented Nov 10, 2020 •

Copy link
Copy Markdown

Any chance to get this released @jdm? Got a use case that could really benefit from this.

@SimonSapin

Copy link
Copy Markdown
Member

https://crates.io/crates/string-cache/0.8.1 is up and includes this change.

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.

5 participants