Update main-custom to latest upstream version

Change-Id: Ibca337dd7a7f37ee4857c85fccd917b47aa3c9d5
Reviewed-on: https://chromium-review.googlesource.com/c/external/github.com/WebKit/JetStream/+/7232297
Reviewed-by: Marja Hölttä <marja@chromium.org>
This commit is contained in:
Camillo Bruni 2025-12-08 14:08:46 +01:00
parent 2ca0706159
commit e71ad6a0b4
8 changed files with 43 additions and 741 deletions

View file

@ -1,630 +0,0 @@
/*
* Copyright (C) 2018-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
:root {
--color-primary: #34AADC;
--color-secondary: #86D9FF;
--text-color-inverse: white;
--text-color-primary: black;
--text-color-secondary: #555555;
--text-color-tertiary: #444444;
--text-color-subtle: #6c6c71;
--text-color-very-subtle: #8E8E93;
--heading-color: #2C98D1;
--link-hover-color: #0086BF;
--button-color-primary: rgb(52, 170, 220);
--error-text-color: #d24a59;
--benchmark-heading-color: rgb(183, 183, 183);
--benchmark-error-text-color: #ff8686;
--benchmark-done-result-color: #4A4A4A;
--gap: 3rem;
--width: 200px;
}
html,
svg text {
font-family: "Helvetica Neue", Helvetica, Verdana, sans-serif;
font-size: 62.5%;
font-synthesis: none;
height: 100vh;
}
body {
display: flex;
flex-direction: column;
gap: var(--gap);
margin: 0;
font-size: 1.6rem;
font-weight: 400;
line-height: 1.4;
background-repeat: no-repeat;
background-position: center -5vw;
background-size: 100vw;
padding-bottom: 0px;
background-image: url('clouds.svg');
overflow-y: hidden;
height: 100%;
}
table {
border-spacing: 0;
}
body.nonDefaultParams {
filter: hue-rotate(152deg);
}
.nonDefaultParams .summary {
display: none;
}
#non-default-params {
display: none;
text-align: center;
& h2 {
text-align: center;
}
& p {
text-align: center;
}
}
.nonDefaultParams #non-default-params {
display: block;
}
#non-standard-params-table {
border-collapse: collapse;
text-align: left;
display: inline-block;
margin-top: var(--gap);
}
#non-standard-params-table tr {
padding: 2px;
}
#non-standard-params-table thead th {
border-bottom: 1px solid var(--foreground);
}
#non-standard-params-table tbody td {
font-weight: normal;
text-align: left;
}
#non-standard-params-table thead th,
#non-standard-params-table tbody td {
padding: 0.1em 0.3em;
}
#non-standard-params-table tbody td:nth-child(2) {
color: var(--highlight);
}
.overflow-scroll {
overflow-y: auto;
}
.overflow-visible {
overflow: visible;
}
::selection {
background-color: var(--color-primary);
color: var(--text-color-inverse);
}
main {
display: flex;
flex-direction: column;
gap: var(--gap);
margin: 0 auto;
padding: 0 var(--gap);
max-width: 1180px;
text-align: center;
flex: 1;
overflow: hidden;
}
main p {
margin: 0;
}
img {
-webkit-user-drag: none;
user-select: none;
}
.logo {
box-sizing: border-box;
width: 100%;
user-select: none;
perspective: 600;
}
.logo .logo-image {
display: block;
box-sizing: border-box;
background-repeat: no-repeat;
background-position: center;
background-image: url('JetStream3Logo.svg');
color: transparent;
animation: swingin 350ms ease-out forwards;
will-change: transform, opacity;
height: 75px;
}
#jetstreams {
background-image: url('jetstreams.svg');
background-repeat: no-repeat;
background-size: contain;
background-position: center;
padding: 2rem 0;
margin: -2rem 0;
}
#jetstreams svg {
width: 100%;
max-height: 120px;
}
#magic {
position: absolute;
top: -900px;
left: -900px;
width: 300px;
height: 300px;
display: none;
}
.summary {
text-align: center;
}
.summary:empty {
display: none;
}
article,
.summary {
max-width: 70rem;
margin: 0 auto 0 auto;
opacity: 0;
animation: fadein 0.5s ease-in-out forwards;
animation-delay: 200ms;
}
article {
display: flex;
flex-direction: column;
gap: var(--gap);
}
h1 {
color: var(--text-color-primary);
text-align: center;
margin-bottom: 0;
}
h2,
h3,
h4,
h5,
h6 {
color: var(--heading-color);
text-align: left;
}
h4,
h5,
h6 {
margin-bottom: 0;
}
p {
text-align: left;
color: var(--text-color-secondary);
}
h5,
h6 {
font-size: 1.6rem;
}
h6 {
color: var(--text-color-tertiary);
}
dt {
margin-top: 10px;
font-weight: bold;
text-align: left;
}
dd {
text-align: left;
padding: 10px 20px;
margin: 0;
}
a:link,
a:visited {
color: var(--color-primary);
}
a:hover,
a:active {
color: var(--link-hover-color);
}
#status label,
a.button {
display: inline-block;
font-weight: 500;
text-decoration: none;
font-size: 2rem;
background-color: var(--button-color-primary);
background-image: linear-gradient(180deg, rgba(134, 217, 255, 1) -80%, rgb(52, 170, 220) 100%);
color: var(--text-color-inverse);
border: 1px solid var(--button-color-primary);
border-radius: 2px;
padding: 0.3rem 0.3rem 0.5rem;
text-align: center;
width: var(--width);
-webkit-touch-callout: none;
user-select: none;
}
a.button {
animation: fadein 500ms ease-in forwards, scaledown 500ms ease-in forwards;
opacity: 0;
}
#status label,
.button:hover {
background-image: none;
}
#status.loading {
position: absolute;
top: 0;
left: 0;
margin: 48vh 0 0;
width: 100%;
line-height: 1.2;
font-size: 4rem;
font-style: italic;
font-weight: 500;
letter-spacing: -0.10rem;
color: transparent;
background-image: linear-gradient(132deg, #96E5FF 0%, #96E5FF 2%, #86D9FF 42%, #8BDAFF 84%, #96E5FF 98%, #96E5FF 100%);
-webkit-background-clip: text;
background-repeat: no-repeat;
-webkit-touch-callout: none;
user-select: none;
}
#status.error {
max-width: 70rem;
margin: 0 auto 1rem;
}
.error h2,
.error p {
color: var(--error-text-color);
margin-bottom: 0;
text-align: center;
font-weight: 500;
}
.error h2 {
font-size: 5rem;
letter-spacing: -0.1rem;
line-height: 1;
}
#result-summary:empty {
display: none;
}
#result-summary {
margin-top: 20px;
}
#result-summary label {
color: var(--text-color-subtle);
}
#result-summary .score {
font-weight: bold;
font-size: 4rem;
line-height: 1;
color: var(--color-primary);
font-weight: 500;
}
.benchmark .plot svg {
display: inline-block;
vertical-align: middle;
}
#result-summary .score .interval {
display: block;
font-weight: normal;
}
#results {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
gap: var(--gap);
margin: 0 calc(var(--gap) * -1) 0 calc(-var(--gap) * -1);
animation: fadein 500ms ease-out forwards;
opacity: 0;
overflow-y: auto;
flex: 1;
padding-bottom: var(--gap);
box-sizing: border-box;
}
.benchmark {
position: relative;
flex: 1;
max-width: 20%;
min-width: var(--width);
text-align: left;
color: var(--text-color-very-subtle);
font-size: 1.6rem;
scroll-margin-top: 20vh;
scroll-margin-bottom: 20vh;
}
.benchmark .result.detail {
display: none;
}
.details .benchmark .result.detail {
display: inline-block;
}
.benchmark h4,
.benchmark .result,
.benchmark label,
.benchmark .plot {
color: transparent;
background: linear-gradient(160deg, rgba(249, 249, 249, 1) 0%, rgba(238, 238, 238, 1) 100%);
border-radius: 3px;
}
.benchmark h3 {
color: var(--benchmark-heading-color);
}
.benchmark-running h4,
.benchmark-running .result,
.benchmark-running label,
.benchmark-running .plot {
color: var(--color-secondary);
background-color: var(--color-secondary);
background-image: none;
}
.benchmark-done h3,
.benchmark-done h4,
.benchmark-done .result,
.benchmark-done label,
.benchmark-done .plot {
background-color: transparent;
background-image: none;
-webkit-touch-callout: revert;
user-select: text;
}
.benchmark-error h4,
.benchmark-error .result,
.benchmark-error label,
.benchmark-error .plot {
color: var(--benchmark-error-text-color);
background-color: var(--benchmark-error-text-color);
background-image: none;
}
.benchmark-error h3 {
color: var(--benchmark-error-text-color);
}
.benchmark h3 {
font-weight: 400;
font-size: 1.6rem;
margin: 0;
}
.benchmark-running h3 {
background-color: transparent;
background-image: none;
color: var(--color-primary);
}
.benchmark-done h3 {
color: var(--text-color-subtle);
}
.benchmark a.info {
display: inline-block;
width: 1.5rem;
height: 1.5rem;
border-radius: 100%;
background-color: var(--benchmark-heading-color);
color: var(--text-color-inverse) !important;
user-select: none;
text-align: center;
vertical-align: middle;
font-style: italic;
font-weight: bold;
font-family: 'Times New Roman', Times, serif;
line-height: 1.6rem;
margin-top: -0.2rem;
}
.benchmark-running a.info {
background-color: var(--color-primary);
}
.benchmark-done a.info {
background-color: var(--text-color-subtle);
}
.benchmark h3 a,
.benchmark h3 a:link,
.benchmark h3 a:active,
.benchmark h3 a:hover,
.benchmark h3 a:visited {
color: inherit;
text-decoration: none;
}
.benchmark-done h3 a:hover {
color: var(--color-primary);
text-decoration: underline;
}
.benchmark h4 {
margin: 0.3rem 0;
line-height: 1;
font-weight: 400;
font-size: 2.4rem;
}
.benchmark-done h4 {
color: var(--color-primary);
background-color: none;
}
.benchmark p,
.benchmark-done p {
margin: 0;
}
.benchmark .result {
display: inline-block;
margin-right: 1.6rem;
line-height: 1.3;
font-size: 1.3rem;
font-weight: bold;
}
#result-summary .benchmark {
text-align: center;
max-width: 100%;
margin: 0;
margin-left: 1.6rem;
}
.benchmark-done .result {
color: var(--benchmark-done-result-color);
}
.benchmark label {
display: block;
}
.benchmark-done label {
color: var(--text-color-very-subtle);
font-weight: 400;
}
dt:target {
background-color: var(--color-secondary);
color: var(--text-color-inverse);
padding-left: 10px;
border-radius: 5px;
}
.plot svg circle {
fill: var(--color-primary);
opacity: 0.8;
}
@keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes scaledown {
from {
transform: scale(1.3, 1.3);
}
to {
transform: scale(1, 1);
}
}
@keyframes shine {
0% {
background-position: -1200px center;
}
100% {
background-position: 100vw center;
}
}
@keyframes swingin {
from {
opacity: 0;
transform: rotateY(-85deg) translateZ(200px);
}
to {
opacity: 1;
transform: rotateY(0deg) translateZ(0px);
}
}
@media (max-width: 415px) {
body {
background-position: center 4rem;
}
.logo .logo-image {
height: 60px;
}
#jetstreams {
background-size: 200%;
}
}

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 9.9 KiB

View file

@ -560,8 +560,18 @@ const BenchmarkState = Object.freeze({
class Scripts {
constructor() {
constructor(preloads) {
this.scripts = [];
let preloadsCode = "";
let resourcesCode = "";
for (let { name, resource, blobURLOrPath } of preloads) {
console.assert(name?.length > 0, "Invalid preload name.");
console.assert(resource?.length > 0, "Invalid preload resource.");
console.assert(blobURLOrPath?.length > 0, "Invalid preload data.");
preloadsCode += `${JSON.stringify(name)}: "${blobURLOrPath}",\n`;
resourcesCode += `${JSON.stringify(resource)}: "${blobURLOrPath}",\n`;
}
// Expose a globalThis.JetStream object to the workload. We use
// a proxy to prevent prototype access and throw on unknown properties.
this.add(`
@ -569,11 +579,16 @@ class Scripts {
get(target, property, receiver) {
throw new Error(name + "." + property + " is not defined.");
}
});
});
globalThis.JetStream = {
__proto__: throwOnAccess("JetStream"),
preload: {
__proto__: throwOnAccess("JetStream.preload"),
${preloadsCode}
},
resources: {
__proto__: throwOnAccess("JetStream.preload"),
${resourcesCode}
},
};
`);
@ -631,8 +646,8 @@ class Scripts {
}
class ShellScripts extends Scripts {
constructor() {
super();
constructor(preloads) {
super(preloads);
this.prefetchedResources = Object.create(null);;
}
@ -698,8 +713,8 @@ class ShellScripts extends Scripts {
}
class BrowserScripts extends Scripts {
constructor() {
super();
constructor(preloads) {
super(preloads);
this.add("window.onerror = top.currentReject;");
}
@ -738,7 +753,7 @@ class Benchmark {
this.isAsync = !!plan.isAsync;
this.allowUtf16 = !!plan.allowUtf16;
this.scripts = null;
this.preloads = null;
this.preloads = [];
this.shellPrefetchedResources = null;
this.results = [];
this._state = BenchmarkState.READY;
@ -898,7 +913,7 @@ class Benchmark {
if (this.isDone)
throw new Error(`Cannot run Benchmark ${this.name} twice`);
this._state = BenchmarkState.PREPARE;
const scripts = isInBrowser ? new BrowserScripts() : new ShellScripts();
const scripts = isInBrowser ? new BrowserScripts(this.preloads) : new ShellScripts(this.preloads);
if (!!this.plan.deterministicRandom)
scripts.addDeterministicRandom()
@ -908,15 +923,6 @@ class Benchmark {
if (this.shellPrefetchedResources) {
scripts.addPrefetchedResources(this.shellPrefetchedResources);
}
if (this.plan.preload) {
let preloadCode = "";
for (let [ variableName, blobURLOrPath ] of this.preloads) {
console.assert(variableName?.length > 0, "Invalid preload name.");
console.assert(blobURLOrPath?.length > 0, "Invalid preload data.");
preloadCode += `JetStream.preload[${JSON.stringify(variableName)}] = "${blobURLOrPath}";\n`;
}
scripts.add(preloadCode);
}
const prerunCode = this.prerunCode;
if (prerunCode)
@ -1067,12 +1073,11 @@ class Benchmark {
}));
if (this.plan.preload) {
this.preloads = [];
for (const [name, resource] of Object.entries(this.plan.preload)) {
promises.push(this.loadBlob("preload", name, resource).then((blobData) => {
if (!globalThis.allIsGood)
return;
this.preloads.push([ blobData.prop, blobData.blobURL ]);
this.preloads.push({ name: blobData.prop, resource: blobData.resource, blobURLOrPath: blobData.blobURL });
this.updateCounter();
}).catch((error) => {
// We'll try again later in retryPrefetchResourceForBrowser(). Don't throw an error.
@ -1099,7 +1104,7 @@ class Benchmark {
if (type == "preload") {
if (this.failedPreloads && this.failedPreloads[blobData.prop]) {
this.failedPreloads[blobData.prop] = false;
this.preloads.push([ blobData.prop, blobData.blobURL ]);
this.preloads.push({ name: blobData.prop, resource: blobData.resource, blobURLOrPath: blobData.blobURL });
counter.failedPreloadResources--;
}
}
@ -1112,7 +1117,7 @@ class Benchmark {
if (!globalThis.allIsGood)
return;
if (blobData.type == "preload")
this.preloads.push([ blobData.prop, blobData.blobURL ]);
this.preloads.push({ name: blobData.prop, resource: blobData.resource, blobURLOrPath: blobData.blobURL });
this.updateCounter();
});
@ -1150,8 +1155,7 @@ class Benchmark {
console.assert(this.scripts === null, "This initialization should be called only once.");
this.scripts = this.plan.files.map(file => shellFileLoader.load(file));
console.assert(this.preloads === null, "This initialization should be called only once.");
this.preloads = [];
console.assert(this.preloads.length === 0, "This initialization should be called only once.");
this.shellPrefetchedResources = Object.create(null);
if (!this.plan.preload) {
return;
@ -1170,7 +1174,7 @@ class Benchmark {
this.shellPrefetchedResources[resource] = bytes;
}
this.preloads.push([name, resource]);
this.preloads.push({ name, resource, blobURLOrPath: resource });
}
}
@ -2516,8 +2520,8 @@ let BENCHMARKS = [
inputFontItalic: "./Kotlin-compose/build/jetbrainsmono_italic.ttf",
inputFontRegular: "./Kotlin-compose/build/jetbrainsmono_regular.ttf"
},
iterations: 15,
worstCaseCount: 2,
iterations: 5,
worstCaseCount: 1,
tags: ["default", "Wasm"],
}),
new AsyncBenchmark({

View file

@ -1,15 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1582" height="400" viewBox="0 0 1582 400" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Copyright © 2019 Apple Inc. All rights reserved. -->
<defs>
<path id="b" d="M1581.5351,399.898438 L1581.5351,358.005601 C1581.5351,312.268183 1541.19277,275.1917 1491.43042,275.1917 C1450.64807,275.1917 1416.21078,300.099758 1405.10264,334.260413 C1400.43887,333.385508 1395.61073,332.926025 1390.66617,332.926025 C1388.37195,332.926025 1386.10341,333.036175 1383.86398,333.229724 C1376.13724,267.399376 1315.50132,216.14187 1241.82258,216.14187 C1199.31271,216.14187 1161.16187,233.219838 1134.9872,260.299423 C1113.40269,263.202662 1094.87257,274.711761 1083.62404,290.913249 C1073.08089,286.962012 1061.57383,284.746424 1049.51034,284.658304 C1044.8089,230.165536 995.241732,187.282576 934.742775,187.282576 C879.5873,187.282576 833.514544,222.927109 822.238618,270.513473 C806.788579,260.746317 788.255038,254.823396 768.250798,254.201835 C768.855171,251.032663 769.18732,247.780091 769.18732,244.451989 C769.18732,213.446343 741.83986,188.311692 708.104535,188.311692 C696.749852,188.311692 686.126238,191.167723 677.017838,196.127619 C663.949337,174.58071 638.921781,160 610.177243,160 C568.537128,160 534.69394,190.587075 533.736873,228.645467 C507.409829,230.16711 484.936733,244.705333 473.845714,265.347439 C452.004386,227.565997 408.768588,201.827094 358.973715,201.827094 C322.127494,201.827094 288.886968,215.937306 265.229096,238.56998 C261.739825,237.690353 258.069071,237.211988 254.276757,237.211988 C236.873206,237.211988 221.99501,247.101882 215.903339,261.097224 C210.077045,258.211294 203.411818,256.571633 196.328838,256.571633 C173.761577,256.571633 155.431776,273.199559 155.024295,293.851107 C140.462839,286.979322 123.970128,283.078439 106.475835,283.078439 C47.6701506,283.078439 4.8316906e-13,326.89138 4.8316906e-13,380.938827 L0,399.898438"/>
<filter id="a" width="120.5%" height="235.5%" x="-10.3%" y="-78.2%" filterUnits="objectBoundingBox">
<feOffset dy="-25" in="SourceAlpha" result="shadowOffsetOuter1"/>
<feGaussianBlur stdDeviation="50" in="shadowOffsetOuter1" result="shadowBlurOuter1"/>
<feColorMatrix values="0 0 0 0 0.807429766 0 0 0 0 0.94268743 0 0 0 0 1 0 0 0 1 0" in="shadowBlurOuter1"/>
</filter>
</defs>
<g fill="none" fill-rule="evenodd">
<use fill="black" filter="url(#a)" xlink:href="#b"/>
<use fill="white" xlink:href="#b"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.5 KiB

View file

@ -38,12 +38,12 @@ const isLittleEndian = computeIsLittleEndian();
async function *randomFileContents() {
let counter = 1;
while(true) {
const numBytes = ((counter * 1192.18851371) % 2056);
const numBytes = (((counter * 1192.18851371) | 0) % 2056);
counter++;
let result = new ArrayBuffer(numBytes);
let view = new Uint8Array(result);
for (let i = 0; i < numBytes; ++i)
view[i] = (i + counter) % 255;
view[i] = (i + counter) % 256;
yield new DataView(result);
}
}

View file

@ -38,12 +38,12 @@ const isLittleEndian = computeIsLittleEndian();
function *randomFileContents() {
let counter = 1;
while(true) {
const numBytes = ((counter * 1192.18851371) % 2056);
const numBytes = (((counter * 1192.18851371) | 0) % 2056);
counter++;
let result = new ArrayBuffer(numBytes);
let view = new Uint8Array(result);
for (let i = 0; i < numBytes; ++i)
view[i] = (i + counter) % 255;
view[i] = (i + counter) % 256;
yield new DataView(result);
}
};

View file

@ -1,46 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="2647" height="120" viewBox="0 0 2647 120">
<!-- Copyright © 2019 Apple Inc. All rights reserved. -->
<style>
.line {
mix-blend-mode: multiply;
stroke-dasharray: 2680;
stroke-dashoffset: 2680;
animation: dash 1.1s ease-in forwards;
animation-delay: 400ms;
}
.line.second {
animation-delay: 500ms;
animation-duration: 900ms;
}
.line.third {
animation-delay: 600ms;
animation-duration: 800ms;
}
.line.fourth {
animation-delay: 700ms;
animation-duration: 700ms;
}
.line.fifth {
animation-delay: 800ms;
animation-duration: 600ms;
}
@keyframes dash {
to {
stroke-dashoffset: 0;
}
}
</style>
<g fill="none" fill-rule="evenodd" opacity=".8" stroke-dasharray="2680" stroke-linecap="square" stroke="#B9EAFF" stroke-width="5">
<path class="line" d="M0.381287582,77.2851563 C45.5977594,100.205019 115.707877,111.66495 210.71164,111.66495 C353.217284,111.66495 433.15655,50.4282334 626.183452,50.4282334 C819.210355,50.4282334 1003.20257,83.2313059 1085.21867,84.6042334 C1167.23478,85.977161 1231.04683,71 1322.53193,71 C1414.01704,71 1405.89836,77.9769045 1469.70623,77.9769045 C1533.51411,77.9769045 1858.0854,41.1147334 1982.42221,41.1152334 C2106.759,41.1157334 2336.34112,96.9169334 2457.44102,96.9169334 C2538.17429,96.9169334 2612.48771,90.6035905 2680.38129,77.9769045"/>
<path class="line second" d="M0.381287582,77.2851563 C52.8221181,59.380541 115.923899,50.4282334 189.68663,50.4282334 C300.330726,50.4282334 463.775156,77.2851563 587.977497,77.2851563 C712.179836,77.2851563 841.854221,41.1162334 960.608924,41.1157334 C1079.36363,41.1152334 1175.54909,71 1267.0342,71 C1358.5193,71 1486.92586,84.8073502 1579.31596,84.8073502 C1671.70606,84.8073502 1951.64553,37.773825 2091.51218,38.3793587 C2231.37883,38.9848924 2309.70347,76.3864611 2465.75572,78.8007813 C2569.79056,80.410328 2641.3324,76.8419454 2680.38129,68.0956334"/>
<path class="line third" d="M0.381287582,68.0956334 C46.104713,82.5628758 116.468307,89.796497 211.472071,89.796497 C353.977713,89.796497 569.766201,41.1157334 695.40436,41.1157334 C821.042519,41.1157334 1029.874,71.5221545 1121.3591,71.5221545 C1212.84421,71.5221545 1231.04683,71 1322.53193,71 C1414.01704,71 1470.55153,86.8321594 1614.81651,89.796497 C1759.08149,92.7608346 1917.33862,49.8226997 2057.20527,50.4282334 C2197.07192,51.0337671 2372.16992,114.838073 2475.15354,114.838073 C2543.8093,114.838073 2612.21853,107.48016 2680.38129,92.7643334"/>
<path class="line fourth" d="M0.381287582,50.4282334 C39.5600335,20.8094111 105.603499,5.66666667 198.511683,5 C337.873959,4 411.779393,89.7993958 588.034245,89.7993958 C764.289095,89.7993958 886.574266,57.2387752 996.542944,57.2387752 C1106.51162,57.2387752 1231.16568,71 1322.65962,71 C1414.15356,71 1447.8544,56.1829752 1541.98759,57.2387752 C1636.12078,58.2945752 1817.26413,89.8073502 1971.66487,89.8073502 C2126.06561,89.8073502 2305.87367,16.3803334 2455.48134,17.3806334 C2555.2198,18.0475001 2629.51978,33.3807334 2678.38129,63.3803334"/>
<path class="line fifth" d="M0.381287582,50.4282334 C100.711815,28.2065001 198.37896,17.0956334 293.382723,17.0956334 C435.888367,17.0956334 531.07636,67.2833421 716.990501,71.5221545 C902.904641,75.7609669 1020.95162,46.3806334 1100.3489,46.3806334 C1179.74619,46.3806334 1250.52195,71 1342.00705,71 C1433.49216,71 1503.60201,41.3248334 1597.7261,42.3806334 C1691.8502,43.4364334 1891.84425,89.1938621 2031.7109,89.7993958 C2171.57755,90.4049295 2341.72526,52.2362334 2469.03608,52.2362334 C2553.90996,52.2362334 2624.35836,59.7595397 2680.38129,74.8061523"/>
<path class="line third" d="M0.381287582,63.3803334 C29.9004627,42.0463503 86.1138292,31.3793587 169.021387,31.3793587 C293.382723,31.3793587 530.433313,103.701906 703.857385,103.731049 C877.281458,103.760193 1001.04857,58.6844334 1102.10823,59.8364334 C1203.1679,60.9884334 1231.04683,71 1322.53193,71 C1414.01704,71 1625.37248,44.1157334 1733.57121,44.1157334 C1841.76995,44.1157334 1984.50341,75.8774804 2102.06815,76.3864611 C2219.6329,76.8954417 2348.05336,31.3793587 2475.36419,31.3793587 C2531.94676,31.3793587 2600.2858,43.232817 2680.38129,66.9397334"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 4.4 KiB

View file

@ -16,13 +16,14 @@ globalThis.URL = URL;
// Polyfill fetch for shell-compatibility and to cache / preload model weights etc.
let preload = { /* Initialized in init() below due to async. */ };
const originalFetch = globalThis.fetch ?? function(url) {
throw new Error("no fetch available");
}
globalThis.fetch = async function(url) {
async function redirectingFetch(url) {
// DEBUG
// console.log('fetch', url);
if (url.startsWith("./"))
url = JetStream.resources[url];
// Redirect some paths to cached/preloaded resources.
if (preload[url]) {
return {
@ -38,8 +39,7 @@ globalThis.fetch = async function(url) {
};
}
// This should only be called in the browser, where fetch() is available.
return originalFetch(url);
throw new Error(`Unexpected resource requested in benchmark: ${url}`);
};
// JetStream benchmark harness. Reuse for two different Transformers.js tasks.
@ -66,6 +66,9 @@ class Benchmark {
// DEBUG
// console.log('inputFile', this.inputFile.byteLength, 'bytes');
}
// After we have loaded everything close the door behind us to make sure no other network requests happen.
globalThis.fetch = redirectingFetch;
}
async runIteration() {