next.js
94554c03 - Turbopack: Use `RawValue` for `mappings` inside `SourceMapJson` (#84208)

Commit
96 days ago
Turbopack: Use `RawValue` for `mappings` inside `SourceMapJson` (#84208) Normally `serde_json` has to handle JSON string escaping, which has some overhead. With `Box<RawValue>` it can just memcpy the raw string instead. More ideally we'd use `&RawValue`, but we'd need a `str` instead of a `Rope` to do that. https://docs.rs/serde_json/latest/serde_json/value/struct.RawValue.html This works because we don't care about the value of `mappings` here, we just want to make sure it's passed through when the struct is re-serialized. We use `RawValue` a lot in the `swc-sourcemap` crate: https://github.com/swc-project/swc-sourcemap/blob/main/src/lazy/mod.rs
Author
bgw bgw
Parents
Loading