-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
857 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import com.huanshankeji.CommonDependencies | ||
import com.huanshankeji.CommonGradleClasspathDependencies | ||
import com.huanshankeji.CommonVersions | ||
|
||
val projectVersion = "0.3.0-SNAPSHOT" | ||
|
||
val commonVersions = CommonVersions() | ||
val commonDependencies = CommonDependencies(commonVersions) | ||
val commonGradleClasspathDependencies = CommonGradleClasspathDependencies(commonVersions) | ||
|
||
object DependencyVersions { | ||
val exposedAdtMapping = "0.1.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import com.huanshankeji.team.`Shreck Ye` | ||
import com.huanshankeji.team.pomForTeamDefaultOpenSource | ||
import com.huanshankeji.team.repositoriesAddTeamGithubPackagesMavenRegistry | ||
import org.gradle.kotlin.dsl.repositories | ||
|
||
plugins { | ||
id("com.huanshankeji.team.with-group") | ||
id("com.huanshankeji.kotlin-jvm-library-sonatype-ossrh-publish-conventions") | ||
id("com.huanshankeji.team.default-github-packages-maven-publish") | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
} | ||
repositoriesAddTeamGithubPackagesMavenRegistry("kotlin-common") | ||
|
||
kotlin.jvmToolchain(8) | ||
|
||
version = projectVersion | ||
|
||
publishing.publications.getByName<MavenPublication>("maven") { | ||
pomForTeamDefaultOpenSource(project, "Exposed Vert.x SQL Client", "Exposed on top of Vert.x Reactive SQL Client") { | ||
`Shreck Ye`() | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
lib/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/AbstractBenchmark.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.huanshankeji.exposed.benchmark | ||
|
||
import kotlinx.benchmark.Measurement | ||
import kotlinx.benchmark.Scope | ||
import kotlinx.benchmark.State | ||
import kotlinx.benchmark.Warmup | ||
|
||
@State(Scope.Benchmark) | ||
@Warmup(time = 1, iterations = 2) | ||
@Measurement(time = 1, iterations = 2) | ||
abstract class AbstractBenchmark |
13 changes: 13 additions & 0 deletions
13
lib/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/EmptyBenchmark.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.huanshankeji.exposed.benchmark | ||
|
||
import kotlinx.benchmark.Benchmark | ||
import kotlinx.benchmark.Scope | ||
import kotlinx.benchmark.State | ||
|
||
@State(Scope.Benchmark) | ||
class EmptyBenchmark : AbstractBenchmark() { | ||
// for comparison | ||
@Benchmark | ||
fun empty() { | ||
} | ||
} |
99 changes: 99 additions & 0 deletions
99
...rc/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/PreparedSqlGenerationBenchmark.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package com.huanshankeji.exposed.benchmark | ||
|
||
import com.huanshankeji.exposed.benchmark.table.VarcharTable | ||
import com.huanshankeji.exposed.deleteAllStatement | ||
import com.huanshankeji.exposed.deleteWhereStatement | ||
import com.huanshankeji.exposed.insertStatement | ||
import com.huanshankeji.exposed.updateStatement | ||
import kotlinx.benchmark.* | ||
import kotlinx.coroutines.* | ||
import org.jetbrains.exposed.sql.* | ||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq | ||
import org.jetbrains.exposed.sql.statements.Statement | ||
import org.jetbrains.exposed.sql.transactions.transaction | ||
|
||
@State(Scope.Benchmark) | ||
class PreparedSqlGenerationBenchmark : WithContainerizedDatabaseBenchmark() { | ||
enum class StatementEnum(val statement: Statement<*>) { | ||
SelectAll(VarcharTable.selectAll()), | ||
SelectWhere(VarcharTable.select(VarcharTable.id eq 0L)), | ||
Insert(VarcharTable.insertStatement { it[varcharColumn] = "string" }), | ||
Update(VarcharTable.updateStatement({ VarcharTable.id eq 0L }) { | ||
it[varcharColumn] = "string" | ||
}), | ||
DeleteAll(VarcharTable.deleteAllStatement()), | ||
DeleteStatement(VarcharTable.deleteWhereStatement { VarcharTable.id eq 0L }) | ||
} | ||
|
||
@Param("SelectAll", "SelectWhere", "Insert", "Update", "DeleteAll", "DeleteStatement") | ||
lateinit var statementEnum: StatementEnum | ||
val statement get() = statementEnum.statement | ||
|
||
/* | ||
var transaction: Transaction? = null | ||
val releaseTransactionMutex = Mutex(true) | ||
@OptIn(DelicateCoroutinesApi::class) | ||
val context = newSingleThreadContext("keep transaction alive") | ||
override fun setUp() { | ||
// for debugging purposes | ||
fun println(x:Int) = println("break point $x") | ||
super.setUp() | ||
println(1) | ||
runBlocking { | ||
println(2) | ||
val setTransactionMutex = Mutex(true) | ||
println(3) | ||
CoroutineScope(context).launch { | ||
// doesn't work because the transaction is stored into the current thread's `ThreadLocal` for `arguments()` to use | ||
newSuspendedTransaction (db = database) { | ||
println(4) | ||
transaction = this | ||
println(5) | ||
setTransactionMutex.unlock() | ||
println(6) | ||
releaseTransactionMutex.lock() | ||
println(7) | ||
} | ||
} | ||
println(8) | ||
setTransactionMutex.lock() | ||
println(9) | ||
} | ||
println(10) | ||
} | ||
override fun tearDown() { | ||
transaction = null | ||
releaseTransactionMutex.unlock() | ||
println("isActive: " + context.isActive) | ||
context.cancel() | ||
super.tearDown() | ||
} | ||
*/ | ||
|
||
companion object { | ||
const val `1M` = 1000_000 | ||
} | ||
|
||
@Benchmark | ||
fun prepareSQL1M() { | ||
transaction(database) { | ||
repeat(`1M`) { | ||
statement.prepareSQL(this) | ||
} | ||
} | ||
} | ||
|
||
@Benchmark | ||
fun arguments1M() { | ||
transaction(database) { | ||
repeat(`1M`) { | ||
statement.arguments() | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.