mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
31 lines
665 B
JavaScript
31 lines
665 B
JavaScript
import { bench, run } from "../runner.mjs";
|
|
|
|
bench("new Blob(['hello world'])", function () {
|
|
return new Blob(["hello world"]);
|
|
});
|
|
|
|
var small = new Blob([JSON.stringify("hello world ")]);
|
|
bench("blob.text(small string)", function () {
|
|
return small.text();
|
|
});
|
|
|
|
bench("blob.arrayBuffer(small string)", function () {
|
|
return small.arrayBuffer();
|
|
});
|
|
|
|
// if (Blob.prototype.json) {
|
|
// bench("blob.json(small string)", function () {
|
|
// return small.json();
|
|
// });
|
|
// }
|
|
|
|
bench("blob.slice()", function () {
|
|
return small.slice();
|
|
});
|
|
|
|
if ((await small.text()) !== JSON.stringify("hello world ")) {
|
|
throw new Error("blob.text() failed");
|
|
}
|
|
|
|
await run();
|