Illustrate build timings in serde_core readme
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Tolnay · committed by David Tolnay · parent 9cf3f2e · Browse files · 2 files·+36 added−2 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+36 added−2 removed
- other:+36 added−2 removed
Provenance
- Commit
900c922- Tree
18a87cc- Author
David Tolnay <dtolnay@gmail.com>- Committer
David Tolnay <dtolnay@gmail.com>- Parent
9cf3f2e
2 files changed+36 added−2 removed
modified:serde_core/src/lib.rs+19 added-1 removed
5 unmodified lines6 //!7 //! In crates that derive an implementation of `Serialize` or `Deserialize`, you8 //! must depend on the [`serde`] crate, not `serde_core`.9 //!10+//! [`serde`]: https://crates.io/crates/serde11+//!12 //! In crates that handwrite implementations of Serde traits, or only use them13 //! as trait bounds, depending on `serde_core` is permitted. But `serde`14 //! re-exports all of these traits and can be used for this use case too. If in15 //! doubt, disregard `serde_core` and always use `serde`.16 //!15-//! [`serde`]: https://crates.io/crates/serde17+//! Crates that depend on `serde_core` instead of `serde` are able to compile in18+//! parallel with `serde_derive` even when `serde`'s "derive" feature is turned on,19+//! as shown in the following build timings.20+//!21+//! <br>22+//!23+//! <table>24+//! <tr><td align="center">When <code>serde_json</code> depends on <code>serde</code></td></tr>25+//! <tr><td><img src="https://github.com/user-attachments/assets/78dc179c-6ab1-4059-928c-1474b0d9d0bb"></td></tr>26+//! </table>27+//!28+//! <br>29+//!30+//! <table>31+//! <tr><td align="center">When <code>serde_json</code> depends on <code>serde_core</code></td></tr>32+//! <tr><td><img src="https://github.com/user-attachments/assets/6b6cff5e-3e45-4ac7-9db1-d99ee8b9f5f7"></td></tr>33+//! </table>34 35 ////////////////////////////////////////////////////////////////////////////////36 37 // Serde types in rustdoc of other crates get linked to here.236 unmodified linesmodified:serde_core/README.md+17 added-1 removed
2 unmodified lines345678910111213121415161718192021222324252627282 unmodified lines
In crates that derive an implementation of `Serialize` or `Deserialize`, youmust depend on the [`serde`] crate, not `serde_core`.
[`serde`]: https://crates.io/crates/serde
In crates that handwrite implementations of Serde traits, or only use them astrait bounds, depending on `serde_core` is permitted. But `serde` re-exports allof these traits and can be used for this use case too. If in doubt, disregard`serde_core` and always use `serde`.
[`serde`]: https://crates.io/crates/serdeCrates that depend on `serde_core` instead of `serde` are able to compile inparallel with `serde_derive` even when `serde`'s "derive" feature is turned on,as shown in the following build timings.
<br>
| When `serde_json` depends on `serde` ||---|| <img src="https://github.com/user-attachments/assets/78dc179c-6ab1-4059-928c-1474b0d9d0bb"> |
<br>
| When `serde_json` depends on `serde_core` ||---|| <img src="https://github.com/user-attachments/assets/6b6cff5e-3e45-4ac7-9db1-d99ee8b9f5f7"> |