mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
perf(web): use DOMString for BlobParts (#13979)
This commit is contained in:
parent
395f527238
commit
697b60a335
2 changed files with 12 additions and 1 deletions
|
@ -56,6 +56,13 @@ function benchUrlParse() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function benchLargeBlobText() {
|
||||||
|
const input = "long-string".repeat(999_999);
|
||||||
|
benchSync("blob_text_large", 3, () => {
|
||||||
|
new Blob([input]).text();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function benchDateNow() {
|
function benchDateNow() {
|
||||||
benchSync("date_now", 5e5, () => {
|
benchSync("date_now", 5e5, () => {
|
||||||
Date.now();
|
Date.now();
|
||||||
|
@ -123,6 +130,7 @@ async function main() {
|
||||||
// A common "language feature", that should be fast
|
// A common "language feature", that should be fast
|
||||||
// also a decent representation of a non-trivial JSON-op
|
// also a decent representation of a non-trivial JSON-op
|
||||||
benchUrlParse();
|
benchUrlParse();
|
||||||
|
benchLargeBlobText();
|
||||||
benchB64RtLong();
|
benchB64RtLong();
|
||||||
benchB64RtShort();
|
benchB64RtShort();
|
||||||
// IO ops
|
// IO ops
|
||||||
|
|
|
@ -394,7 +394,10 @@
|
||||||
return webidl.converters["ArrayBufferView"](V, opts);
|
return webidl.converters["ArrayBufferView"](V, opts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return webidl.converters["USVString"](V, opts);
|
// BlobPart is passed to processBlobParts after conversion, which calls core.encode()
|
||||||
|
// on the string.
|
||||||
|
// core.encode() is equivalent to USVString normalization.
|
||||||
|
return webidl.converters["DOMString"](V, opts);
|
||||||
};
|
};
|
||||||
webidl.converters["sequence<BlobPart>"] = webidl.createSequenceConverter(
|
webidl.converters["sequence<BlobPart>"] = webidl.createSequenceConverter(
|
||||||
webidl.converters["BlobPart"],
|
webidl.converters["BlobPart"],
|
||||||
|
|
Loading…
Reference in a new issue