From 900c922f415f0d2cb97844324146fb96764be1e4 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 13 Sep 2025 16:50:44 -0700 Subject: [PATCH] Illustrate build timings in serde_core readme --- serde_core/README.md | 18 +++++++++++++++++- serde_core/src/lib.rs | 20 +++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/serde_core/README.md b/serde_core/README.md index 7d5460c7..94a765e2 100644 --- a/serde_core/README.md +++ b/serde_core/README.md @@ -4,9 +4,25 @@ The `serde_core` crate contains Serde's trait definitions with **no support for In crates that derive an implementation of `Serialize` or `Deserialize`, you must 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 as trait bounds, depending on `serde_core` is permitted. But `serde` re-exports all of 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/serde +Crates that depend on `serde_core` instead of `serde` are able to compile in +parallel with `serde_derive` even when `serde`'s "derive" feature is turned on, +as shown in the following build timings. + +
+ +| When `serde_json` depends on `serde` | +|---| +| | + +
+ +| When `serde_json` depends on `serde_core` | +|---| +| | diff --git a/serde_core/src/lib.rs b/serde_core/src/lib.rs index e471dd28..b27126b9 100644 --- a/serde_core/src/lib.rs +++ b/serde_core/src/lib.rs @@ -7,12 +7,30 @@ //! In crates that derive an implementation of `Serialize` or `Deserialize`, you //! must 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 //! as trait bounds, depending on `serde_core` is permitted. But `serde` //! re-exports all of 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/serde +//! Crates that depend on `serde_core` instead of `serde` are able to compile in +//! parallel with `serde_derive` even when `serde`'s "derive" feature is turned on, +//! as shown in the following build timings. +//! +//!
+//! +//! +//! +//! +//!
When serde_json depends on serde
+//! +//!
+//! +//! +//! +//! +//!
When serde_json depends on serde_core
////////////////////////////////////////////////////////////////////////////////