Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions JetStreamDriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -905,8 +905,11 @@ class Benchmark {
}
if (this.plan.preload) {
let preloadCode = "";
for (let [ variableName, blobURLOrPath ] of this.preloads)
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);
}

Expand Down Expand Up @@ -1060,8 +1063,8 @@ class Benchmark {

if (this.plan.preload) {
this.preloads = [];
for (let prop of Object.getOwnPropertyNames(this.plan.preload)) {
promises.push(this.loadBlob("preload", prop, this.plan.preload[prop]).then((blobData) => {
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 ]);
Expand All @@ -1070,7 +1073,7 @@ class Benchmark {
// We'll try again later in retryPrefetchResourceForBrowser(). Don't throw an error.
if (!this.failedPreloads)
this.failedPreloads = { };
this.failedPreloads[prop] = true;
this.failedPreloads[name] = true;
JetStream.counter.failedPreloadResources++;
}));
}
Expand Down Expand Up @@ -1127,9 +1130,8 @@ class Benchmark {
}

if (this.plan.preload) {
for (const prop of Object.getOwnPropertyNames(this.plan.preload)) {
const resource = this.plan.preload[prop];
const allDone = await this.retryPrefetchResource("preload", prop, resource);
for (const [name, resource] of Object.entries(this.plan.preload)) {
const allDone = await this.retryPrefetchResource("preload", name, resource);
if (allDone)
return true; // All resources loaded, nothing more to do.
}
Expand All @@ -1149,21 +1151,21 @@ class Benchmark {
if (!this.plan.preload) {
return;
}
for (let [name, file] of Object.entries(this.plan.preload)) {
const compressed = isCompressed(file);
for (let [name, resource] of Object.entries(this.plan.preload)) {
const compressed = isCompressed(resource);
if (compressed && !JetStreamParams.prefetchResources) {
file = uncompressedName(file);
resource = uncompressedName(resource);
}

if (JetStreamParams.prefetchResources) {
let bytes = new Int8Array(read(file, "binary"));
let bytes = new Int8Array(read(resource, "binary"));
if (compressed) {
bytes = zlib.decompress(bytes);
}
this.shellPrefetchedResources[file] = bytes;
this.shellPrefetchedResources[resource] = bytes;
}

this.preloads.push([name, file]);
this.preloads.push([name, resource]);
}
}

Expand Down Expand Up @@ -1753,10 +1755,10 @@ class WasmLegacyBenchmark extends Benchmark {
}

str += "};\n";

const keys = Object.keys(this.plan.preload);
for (let i = 0; i < keys.length; ++i) {
str += `JetStream.loadBlob("${keys[i]}", "${this.plan.preload[keys[i]]}", () => {\n`;
let preloadCount = 0;
for (const [name, resource] of Object.entries(this.plan.preload)) {
preloadCount++;
str += `JetStream.loadBlob(${JSON.stringify(name)}, "${resource}", () => {\n`;
}
if (this.plan.async) {
str += `doRun().catch((e) => {
Expand All @@ -1767,7 +1769,7 @@ class WasmLegacyBenchmark extends Benchmark {
} else {
str += `doRun();`
}
for (let i = 0; i < keys.length; ++i) {
for (let i = 0; i < preloadCount; ++i) {
str += `})`;
}
str += `;`;
Expand Down
35 changes: 35 additions & 0 deletions mobx/dist/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
This file was generated with the generate-license-file npm package!
https://www.npmjs.com/package/generate-license-file

The following npm package may be included in this product:

- mobx@6.13.7

This package contains the following license:

The MIT License (MIT)

Copyright (c) 2015 Michel Weststrate

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

-----------

This file was generated with the generate-license-file npm package!
https://www.npmjs.com/package/generate-license-file
2 changes: 1 addition & 1 deletion mobx/webpack.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { fileURLToPath } from "url";
import TerserPlugin from "terser-webpack-plugin";
import { LicenseFilePlugin } from "generate-license-file-webpack-plugin";

import CacheBusterCommentPlugin from "../startup-helper/BabelCacheBuster.mjs";
import CacheBusterCommentPlugin from "../utils/BabelCacheBuster.mjs";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
Expand Down
Loading