Browse Source

Add wasmJs browser target to jvm-vs-kotlin-native benchmark (#5149)

sh/web-docker-user
Oleksandr Karpovich 3 months ago committed by GitHub
parent
commit
2602ef0299
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      benchmarks/ios/jvm-vs-kotlin-native/README.md
  2. 5
      benchmarks/ios/jvm-vs-kotlin-native/build.gradle.kts
  3. 4
      benchmarks/ios/jvm-vs-kotlin-native/src/wasmJsMain/kotlin/main.wasmjs.kt
  4. 21
      benchmarks/ios/jvm-vs-kotlin-native/src/wasmJsMain/resources/index.html

3
benchmarks/ios/jvm-vs-kotlin-native/README.md

@ -6,3 +6,6 @@
## Run native on MacOS
- `./gradlew runReleaseExecutableMacosArm64` (Works on Arm64 processors)
- `./gradlew runReleaseExecutableMacosX64` (Works on Intel processors)
## Run in web browser:
- `./gradlew wasmJsBrowserProductionRun` (you can see the results printed on the page itself)

5
benchmarks/ios/jvm-vs-kotlin-native/build.gradle.kts

@ -38,6 +38,11 @@ kotlin {
}
}
wasmJs {
browser()
binaries.executable()
}
sourceSets {
val commonMain by getting {
dependencies {

4
benchmarks/ios/jvm-vs-kotlin-native/src/wasmJsMain/kotlin/main.wasmjs.kt

@ -0,0 +1,4 @@
fun main() {
runBenchmarks()
println("Completed!")
}

21
benchmarks/ios/jvm-vs-kotlin-native/src/wasmJsMain/resources/index.html

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Benchmarks Compose + K/Wasm</title>
<script src="compose-benchmarks.js"></script>
<script type="application/javascript">
const log = console.log.bind(console)
console.log = (...args) => {
const message = args.join(' ');
const p = document.createElement('p');
p.textContent = message;
document.body.appendChild(p);
log(...args);
}
</script>
</head>
<body>
Wait for the benchmarks to complete...
</body>
</html>
Loading…
Cancel
Save