Skip to content

Commit 2021474

Browse files
authored
perf: use base64-simd (#112)
1 parent 52ccc1a commit 2021474

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

Cargo.lock

+22-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parcel_sourcemap/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ repository = "https://github.com/parcel-bundler/source-map"
1313
rkyv = "0.7.38"
1414
serde = {version = "1", features = ["derive"], optional = true}
1515
serde_json = { version = "1", optional = true }
16-
base64 = { version = "0.13.0", optional = true }
16+
base64-simd = { version = "0.7", optional = true }
1717
data-url = { version = "0.1.1", optional = true }
1818

1919
[features]
20-
json = ["serde", "serde_json", "base64", "data-url"]
20+
json = ["serde", "serde_json", "base64-simd", "data-url"]

parcel_sourcemap/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ impl SourceMap {
757757
#[cfg(feature = "json")]
758758
pub fn to_data_url(&mut self, source_root: Option<&str>) -> Result<String, SourceMapError> {
759759
let buf = self.to_json(source_root)?;
760-
let b64 = base64::encode(&buf);
760+
let b64 = base64_simd::Base64::STANDARD.encode_to_boxed_str(buf.as_bytes());
761761
Ok(format!(
762762
"data:application/json;charset=utf-8;base64,{}",
763763
b64

0 commit comments

Comments
 (0)