Thoughts about using nightly features from de-facto std crates (e.g. serde)?

145 points kdy1997

While investigating a performance issue of deserialization, I found that serde is repeating some super-inefficient thing.

Namely, it creates serde::__private::de::Content frequently from serde::__private::de::ContentDeserailizer by visiting it and reconstructuring, but ContentDeserailizer has a field named content and the type of it is Content.

So I created a fork (kdy1/serde) and profiled the performance.

Previous

test json_deserialize                     ... bench:     1,226,131 ns/iter (+/- 58,655)

With fork:

test json_deserialize                     ... bench:     339,526 ns/iter (+/- 41,530)

I got this result by invoking cargo bench from kdy1/swc#perf.

I want to make a PR for it, but I'm not sure if it's fine to use nightly-only features from libraries like serde and want to hear opinions about such optimizations before creating one.