@@ -106,34 +106,6 @@ delete globalThis.d8;
106
106
delete globalThis . inIon ;
107
107
delete globalThis . jscOptions ;
108
108
109
- // The JetStream driver doesn't have support for ES6 modules yet.
110
- // Since this file is not an ES module, we have to use a dynamic import.
111
- // However, browsers and different shalls have different requirements on whether
112
- // the path can or may be relative, so try all possible combinations.
113
- // TODO: Support ES6 modules in the driver instead of this one-off solution.
114
- // This probably requires a new `Benchmark` field called `modules` that
115
- // is a map from module variable name (which will hold the resulting module
116
- // namespace object) to relative module URL, which is resolved in the
117
- // `preRunnerCode`, similar to this code here.
118
- async function dynamicJSImport ( path ) {
119
- let result ;
120
- if ( isInBrowser ) {
121
- // In browsers, relative imports don't work since we are not in a module.
122
- // (`import.meta.url` is not defined.)
123
- const pathname = location . pathname . match ( / ^ ( .* \/ ) (?: [ ^ . ] + (?: \. (?: [ ^ \/ ] + ) ) + ) ? $ / ) [ 1 ] ;
124
- result = await import ( location . origin + pathname + './' + path ) ;
125
- } else {
126
- // In shells, relative imports require different paths, so try with and
127
- // without the "./" prefix (e.g., JSC requires it).
128
- try {
129
- result = await import ( path ) ;
130
- } catch {
131
- result = await import ( './' + path ) ;
132
- }
133
- }
134
- return result ;
135
- }
136
-
137
109
class Benchmark {
138
110
skikoInstantiate ;
139
111
mainInstantiate ;
@@ -144,20 +116,20 @@ class Benchmark {
144
116
// console.log("init");
145
117
146
118
preload = {
147
- 'skiko.wasm' : Module . wasmSkikoBinary ,
148
- './compose-benchmarks-benchmarks.wasm' : Module . wasmBinary ,
149
- './composeResources/compose_benchmarks.benchmarks.generated.resources/drawable/compose-multiplatform.png' : Module . inputImageCompose ,
150
- './composeResources/compose_benchmarks.benchmarks.generated.resources/drawable/example1_cat.jpg' : Module . inputImageCat ,
151
- './composeResources/compose_benchmarks.benchmarks.generated.resources/files/example1_compose-community-primary.png' : Module . inputImageComposeCommunity ,
152
- './composeResources/compose_benchmarks.benchmarks.generated.resources/font/jetbrainsmono_italic.ttf' : Module . inputFontItalic ,
153
- './composeResources/compose_benchmarks.benchmarks.generated.resources/font/jetbrainsmono_regular.ttf' : Module . inputFontRegular ,
119
+ 'skiko.wasm' : await getBinary ( wasmSkikoBinary ) ,
120
+ './compose-benchmarks-benchmarks.wasm' : await getBinary ( wasmBinary ) ,
121
+ './composeResources/compose_benchmarks.benchmarks.generated.resources/drawable/compose-multiplatform.png' : await getBinary ( inputImageCompose ) ,
122
+ './composeResources/compose_benchmarks.benchmarks.generated.resources/drawable/example1_cat.jpg' : await getBinary ( inputImageCat ) ,
123
+ './composeResources/compose_benchmarks.benchmarks.generated.resources/files/example1_compose-community-primary.png' : await getBinary ( inputImageComposeCommunity ) ,
124
+ './composeResources/compose_benchmarks.benchmarks.generated.resources/font/jetbrainsmono_italic.ttf' : await getBinary ( inputFontItalic ) ,
125
+ './composeResources/compose_benchmarks.benchmarks.generated.resources/font/jetbrainsmono_regular.ttf' : await getBinary ( inputFontRegular ) ,
154
126
} ;
155
127
156
128
// We patched `skiko.mjs` to not immediately instantiate the `skiko.wasm`
157
129
// module, so that we can move the dynamic JS import here but measure
158
130
// WebAssembly compilation and instantiation as part of the first iteration.
159
- this . skikoInstantiate = ( await dynamicJSImport ( 'Kotlin-compose/build/skiko.mjs' ) ) . default ;
160
- this . mainInstantiate = ( await dynamicJSImport ( 'Kotlin-compose/build/compose-benchmarks-benchmarks.uninstantiated.mjs' ) ) . instantiate ;
131
+ this . skikoInstantiate = ( await dynamicImport ( 'Kotlin-compose/build/skiko.mjs' ) ) . default ;
132
+ this . mainInstantiate = ( await dynamicImport ( 'Kotlin-compose/build/compose-benchmarks-benchmarks.uninstantiated.mjs' ) ) . instantiate ;
161
133
}
162
134
163
135
async runIteration ( ) {
0 commit comments