Add benchmarks for kotlin-graphql library.
This library uses Spring plus kapt. ^KT-49921 In Progress
This commit is contained in:
+38
@@ -0,0 +1,38 @@
|
||||
diff --git a/gradle.properties b/gradle.properties
|
||||
index c230ac55..0709e478 100644
|
||||
--- a/gradle.properties
|
||||
+++ b/gradle.properties
|
||||
@@ -15,7 +15,7 @@ org.gradle.jvmargs=-Xmx2g -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError
|
||||
|
||||
# dependencies
|
||||
kotlinJvmVersion = 1.8
|
||||
-kotlinVersion = 1.5.31
|
||||
+kotlinVersion = 1.6.10
|
||||
kotlinCoroutinesVersion = 1.5.2
|
||||
kotlinxSerializationVersion = 1.3.0
|
||||
|
||||
diff --git a/servers/graphql-kotlin-spring-server/src/main/kotlin/com/expediagroup/graphql/server/spring/execution/SpringDataFetcher.kt b/servers/graphql-kotlin-spring-server/src/main/kotlin/com/expediagroup/graphql/server/spring/execution/SpringDataFetcher.kt
|
||||
index 871ffd39..c886f705 100644
|
||||
--- a/servers/graphql-kotlin-spring-server/src/main/kotlin/com/expediagroup/graphql/server/spring/execution/SpringDataFetcher.kt
|
||||
+++ b/servers/graphql-kotlin-spring-server/src/main/kotlin/com/expediagroup/graphql/server/spring/execution/SpringDataFetcher.kt
|
||||
@@ -38,7 +38,6 @@ open class SpringDataFetcher(
|
||||
private val applicationContext: ApplicationContext
|
||||
) : FunctionDataFetcher(target, fn, objectMapper) {
|
||||
|
||||
- @ExperimentalStdlibApi
|
||||
override fun mapParameterToValue(param: KParameter, environment: DataFetchingEnvironment): Pair<KParameter, Any?>? =
|
||||
if (param.hasAnnotation<Autowired>()) {
|
||||
val qualifier = param.findAnnotation<Qualifier>()?.value
|
||||
diff --git a/servers/graphql-kotlin-spring-server/src/main/kotlin/com/expediagroup/graphql/server/spring/subscriptions/SubscriptionWebSocketHandler.kt b/servers/graphql-kotlin-spring-server/src/main/kotlin/com/expediagroup/graphql/server/spring/subscriptions/SubscriptionWebSocketHandler.kt
|
||||
index e8939483..5edb33f5 100644
|
||||
--- a/servers/graphql-kotlin-spring-server/src/main/kotlin/com/expediagroup/graphql/server/spring/subscriptions/SubscriptionWebSocketHandler.kt
|
||||
+++ b/servers/graphql-kotlin-spring-server/src/main/kotlin/com/expediagroup/graphql/server/spring/subscriptions/SubscriptionWebSocketHandler.kt
|
||||
@@ -30,7 +30,7 @@ class SubscriptionWebSocketHandler(
|
||||
private val objectMapper: ObjectMapper
|
||||
) : WebSocketHandler {
|
||||
|
||||
- @ExperimentalCoroutinesApi
|
||||
+ @OptIn(ExperimentalCoroutinesApi::class)
|
||||
@Suppress("ForbiddenVoid")
|
||||
override fun handle(session: WebSocketSession): Mono<Void> {
|
||||
val response = session.receive()
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index ddc94d0f..d2f5b2f8 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -21,19 +21,15 @@ plugins {
|
||||
allprojects {
|
||||
buildscript {
|
||||
repositories {
|
||||
- mavenCentral()
|
||||
mavenLocal()
|
||||
+ mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
+ mavenLocal()
|
||||
mavenCentral()
|
||||
google()
|
||||
- mavenLocal {
|
||||
- content {
|
||||
- includeGroup("com.expediagroup")
|
||||
- }
|
||||
- }
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/gradle.properties b/gradle.properties
|
||||
index c230ac55..cf0412e9 100644
|
||||
--- a/gradle.properties
|
||||
+++ b/gradle.properties
|
||||
@@ -15,7 +15,7 @@ org.gradle.jvmargs=-Xmx2g -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError
|
||||
|
||||
# dependencies
|
||||
kotlinJvmVersion = 1.8
|
||||
-kotlinVersion = 1.5.31
|
||||
+kotlinVersion = <kotlin_version>
|
||||
kotlinCoroutinesVersion = 1.5.2
|
||||
kotlinxSerializationVersion = 1.3.0
|
||||
|
||||
diff --git a/servers/graphql-kotlin-spring-server/src/main/kotlin/com/expediagroup/graphql/server/spring/execution/SpringDataFetcher.kt b/servers/graphql-kotlin-spring-server/src/main/kotlin/com/expediagroup/graphql/server/spring/execution/SpringDataFetcher.kt
|
||||
index 871ffd39..c886f705 100644
|
||||
--- a/servers/graphql-kotlin-spring-server/src/main/kotlin/com/expediagroup/graphql/server/spring/execution/SpringDataFetcher.kt
|
||||
+++ b/servers/graphql-kotlin-spring-server/src/main/kotlin/com/expediagroup/graphql/server/spring/execution/SpringDataFetcher.kt
|
||||
@@ -38,7 +38,6 @@ open class SpringDataFetcher(
|
||||
private val applicationContext: ApplicationContext
|
||||
) : FunctionDataFetcher(target, fn, objectMapper) {
|
||||
|
||||
- @ExperimentalStdlibApi
|
||||
override fun mapParameterToValue(param: KParameter, environment: DataFetchingEnvironment): Pair<KParameter, Any?>? =
|
||||
if (param.hasAnnotation<Autowired>()) {
|
||||
val qualifier = param.findAnnotation<Qualifier>()?.value
|
||||
diff --git a/servers/graphql-kotlin-spring-server/src/main/kotlin/com/expediagroup/graphql/server/spring/subscriptions/SubscriptionWebSocketHandler.kt b/servers/graphql-kotlin-spring-server/src/main/kotlin/com/expediagroup/graphql/server/spring/subscriptions/SubscriptionWebSocketHandler.kt
|
||||
index e8939483..5edb33f5 100644
|
||||
--- a/servers/graphql-kotlin-spring-server/src/main/kotlin/com/expediagroup/graphql/server/spring/subscriptions/SubscriptionWebSocketHandler.kt
|
||||
+++ b/servers/graphql-kotlin-spring-server/src/main/kotlin/com/expediagroup/graphql/server/spring/subscriptions/SubscriptionWebSocketHandler.kt
|
||||
@@ -30,7 +30,7 @@ class SubscriptionWebSocketHandler(
|
||||
private val objectMapper: ObjectMapper
|
||||
) : WebSocketHandler {
|
||||
|
||||
- @ExperimentalCoroutinesApi
|
||||
+ @OptIn(ExperimentalCoroutinesApi::class)
|
||||
@Suppress("ForbiddenVoid")
|
||||
override fun handle(session: WebSocketSession): Mono<Void> {
|
||||
val response = session.receive()
|
||||
diff --git a/settings.gradle.kts b/settings.gradle.kts
|
||||
index 1a1329f8..c8aba3da 100644
|
||||
--- a/settings.gradle.kts
|
||||
+++ b/settings.gradle.kts
|
||||
@@ -8,6 +8,11 @@ pluginManagement {
|
||||
val pluginPublishPluginVersion: String by settings
|
||||
val springBootVersion: String by settings
|
||||
|
||||
+ repositories {
|
||||
+ mavenLocal()
|
||||
+ gradlePluginPortal()
|
||||
+ }
|
||||
+
|
||||
plugins {
|
||||
kotlin("jvm") version kotlinVersion
|
||||
kotlin("kapt") version kotlinVersion
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// Quite big library written in Kotlin:
|
||||
// - uses Spring boot
|
||||
// - uses Kotlin kapt
|
||||
@file:BenchmarkProject(
|
||||
name = "graphql-kotlin",
|
||||
gitUrl = "https://github.com/ExpediaGroup/graphql-kotlin.git",
|
||||
gitCommitSha = "fac1e41914f6a8a0a494082752a4e3674b812a3f"
|
||||
)
|
||||
|
||||
import java.io.File
|
||||
|
||||
val stableReleasePatch = {
|
||||
"graphql-kotlin-1.6.10.patch" to File("benchmarkScripts/files/graphql-kotlin-1.6.10.patch").inputStream()
|
||||
}
|
||||
|
||||
val currentReleasePatch = {
|
||||
"graphql-kotlin-current.patch" to File("benchmarkScripts/files/graphql-kotlin-current.patch")
|
||||
.readText()
|
||||
.run { replace("<kotlin_version>", currentKotlinVersion) }
|
||||
.byteInputStream()
|
||||
}
|
||||
|
||||
runAllBenchmarks(
|
||||
suite {
|
||||
scenario {
|
||||
title = "Spring server clean build"
|
||||
useGradleArgs("--no-build-cache")
|
||||
|
||||
runTasks(":graphql-kotlin-spring-server:assemble")
|
||||
runCleanupTasks("clean")
|
||||
}
|
||||
|
||||
scenario {
|
||||
title = "Spring client clean build"
|
||||
useGradleArgs("--no-build-cache")
|
||||
|
||||
runTasks(":graphql-kotlin-spring-client:assemble")
|
||||
runCleanupTasks("clean")
|
||||
}
|
||||
|
||||
scenario {
|
||||
title = "Ktor client clean build"
|
||||
useGradleArgs("--no-build-cache")
|
||||
|
||||
runTasks(":graphql-kotlin-ktor-client:assemble")
|
||||
runCleanupTasks("clean")
|
||||
}
|
||||
|
||||
scenario {
|
||||
title = "Incremental Spring server build with ABI change in FederatedSchemaGenerator"
|
||||
useGradleArgs("--no-build-cache")
|
||||
|
||||
runTasks(":graphql-kotlin-spring-server:assemble")
|
||||
applyAbiChangeTo("generator/graphql-kotlin-federation/src/main/kotlin/com/expediagroup/graphql/generator/federation/FederatedSchemaGenerator.kt")
|
||||
}
|
||||
|
||||
scenario {
|
||||
title = "Incremental Spring client build with ABI change in GraphQLClient"
|
||||
useGradleArgs("--no-build-cache")
|
||||
|
||||
runTasks(":graphql-kotlin-spring-server:assemble")
|
||||
applyAbiChangeTo("clients/graphql-kotlin-client/src/main/kotlin/com/expediagroup/graphql/client/GraphQLClient.kt")
|
||||
}
|
||||
},
|
||||
mapOf(
|
||||
"1.6.10" to stableReleasePatch,
|
||||
"1.6.20" to currentReleasePatch
|
||||
)
|
||||
)
|
||||
@@ -59,6 +59,7 @@ fun addBenchmarkTask(
|
||||
|
||||
dependsOn(":kotlin-gradle-plugin:install")
|
||||
|
||||
outputs.upToDateWhen { false }
|
||||
javaLauncher.set(service.launcherFor {
|
||||
languageVersion.set(jdkVersion)
|
||||
})
|
||||
@@ -130,3 +131,8 @@ addBenchmarkTask(
|
||||
) {
|
||||
usesAndroidSdk()
|
||||
}
|
||||
|
||||
addBenchmarkTask(
|
||||
taskName = "benchmarkRegressionGraphql",
|
||||
script = "graphql-kotlin.benchmark.kts"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user