Skip to content

Commit 9ba5e52

Browse files
committed
cleanup comments
1 parent c1cad8e commit 9ba5e52

File tree

2 files changed

+12
-22
lines changed

2 files changed

+12
-22
lines changed

Kotlin-compose/benchmark.js

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -71,36 +71,25 @@ globalThis.WebAssembly.instantiateStreaming = async function(m,i) {
7171
};
7272

7373
// Provide `setTimeout` for Kotlin coroutines.
74-
// Deep in the Compose UI framework, one task is scheduled every 16ms, see
75-
// https://github.com/JetBrains/compose-multiplatform-core/blob/a52f2981b9bc7cdba1d1fbe71654c4be448ebea7/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/spatial/RectManager.kt#L138
76-
// and
77-
// https://github.com/JetBrains/compose-multiplatform-core/blob/a52f2981b9bc7cdba1d1fbe71654c4be448ebea7/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/OnLayoutRectChangedModifier.kt#L56
78-
// We don't want to delay work in the Wall-time based measurement in JetStream,
79-
// but executing this immediately (without delay) produces redundant work that
80-
// is not realistic for a full-browser Kotlin/multiplatform application either,
81-
// according to Kotlin/JetBrains folks.
82-
// Hence the early return for 16ms delays below.
83-
// FIXME: The SpiderMonkey shell doesn't have `setTimeout` (yet). We could also
84-
// polyfill this with `Promise.resolve().then(f)`, but that changes the CPU
85-
// profile slightly on other engines, so it's probably best to just add support.
8674
const originalSetTimeout = setTimeout;
8775
globalThis.setTimeout = function(f, delayMs) {
8876
// DEBUG
8977
// console.log('setTimeout', f, t);
9078

79+
// Deep in the Compose UI framework, one task is scheduled every 16ms, see
80+
// https://github.com/JetBrains/compose-multiplatform-core/blob/a52f2981b9bc7cdba1d1fbe71654c4be448ebea7/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/spatial/RectManager.kt#L138
81+
// and
82+
// https://github.com/JetBrains/compose-multiplatform-core/blob/a52f2981b9bc7cdba1d1fbe71654c4be448ebea7/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/OnLayoutRectChangedModifier.kt#L56
83+
// We don't want to delay work in the Wall-time based measurement in JetStream,
84+
// but executing this immediately (without delay) produces redundant work that
85+
// is not realistic for a full-browser Kotlin/multiplatform application either,
86+
// according to Kotlin/JetBrains folks.
87+
// Hence the early return for 16ms delays.
9188
if (delayMs === 16) return;
9289
if (delayMs !== 0) {
9390
throw new Error('Unexpected delay for setTimeout polyfill: ' + delayMs);
9491
}
9592
originalSetTimeout(f);
96-
97-
// Alternative, if setTimeout is not available in a shell (but that changes
98-
// the performance profile a little bit, so I'd rather not do that):
99-
// Promise.resolve().then(f);
100-
101-
// Yet another alternative is to run the task synchronously, but that obviously
102-
// overflows the stack at some point if the callback itself spawns more work:
103-
// f();
10493
}
10594

10695
// Don't automatically run the main function on instantiation.

Kotlin-compose/build.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ echo -e "Built on $(date --rfc-3339=seconds)" | tee "$BUILD_LOG"
1515
git clone -b ok/jetstream3_hotfix https://github.com/JetBrains/compose-multiplatform.git |& tee -a "$BUILD_LOG"
1616
pushd compose-multiplatform/
1717
git log -1 --oneline | tee -a "$BUILD_LOG"
18-
# FIXME: Use stable 2.3 Kotlin/Wasm toolchain, once available.
18+
# FIXME: Use stable 2.3 Kotlin/Wasm toolchain, once available around Sep 2025.
1919
git apply ../use-beta-toolchain.patch | tee -a "$BUILD_LOG"
2020
pushd benchmarks/multiplatform
2121
./gradlew :benchmarks:wasmJsProductionExecutableCompileSync
@@ -29,7 +29,8 @@ echo "Copying generated files into build/" | tee -a "$BUILD_LOG"
2929
mkdir -p build/ | tee -a "$BUILD_LOG"
3030
cp $BUILD_SRC_DIR/compose-benchmarks-benchmarks.{wasm,uninstantiated.mjs} build/ | tee -a "$BUILD_LOG"
3131
git apply hook-print.patch | tee -a "$BUILD_LOG"
32-
# TODO: Remove once either the Kotlin toolchain or JSC fixes the issue raised in https://github.com/WebKit/JetStream/pull/84#issuecomment-3164672425
32+
# FIXME: Remove once the JSC fixes around JSTag have landed in Safari, see
33+
# https://github.com/WebKit/JetStream/pull/84#issuecomment-3164672425.
3334
git apply jstag-workaround.patch | tee -a "$BUILD_LOG"
3435
cp $BUILD_SRC_DIR/skiko.{wasm,mjs} build/ | tee -a "$BUILD_LOG"
3536
git apply skiko-disable-instantiate.patch | tee -a "$BUILD_LOG"

0 commit comments

Comments
 (0)