Skip to content

Commit 28e71df

Browse files
author
Abduqodiri Qurbonzoda
committed
Refactor list builder benchmark generators
1 parent d882535 commit 28e71df

File tree

26 files changed

+211
-175
lines changed

26 files changed

+211
-175
lines changed

benchmarks-libraries/src/jmh/java/benchmarks/immutableList/clojure/builder/utils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fun persistentListBuilderAdd(size: Int, immutablePercentage: Double): clojure.la
2525

2626
var list = clojure.lang.PersistentVector.EMPTY
2727
repeat(times = immutableSize) {
28-
list = list.cons("some element")
28+
list = list.cons("another element")
2929
}
3030

3131
val builder = list.asTransient() as clojure.lang.ITransientVector

benchmarks-libraries/src/jmh/java/benchmarks/immutableList/kotlin/builder/utils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fun persistentListBuilderAdd(size: Int, immutablePercentage: Double): kotlinx.co
2525

2626
var list = kotlinx.collections.immutable.persistentListOf<String>()
2727
repeat(times = immutableSize) {
28-
list = list.add("some element")
28+
list = list.add("another element")
2929
}
3030

3131
val builder = list.builder()

benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguroRrbTree/Add.kt renamed to benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguro/Add.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
// Auto-generated file. DO NOT EDIT!
1818

19-
package benchmarks.immutableList.paguroRrbTree
19+
package benchmarks.immutableList.paguro
2020

2121
import org.openjdk.jmh.annotations.*
2222
import java.util.concurrent.TimeUnit

benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguroRrbTree/Get.kt renamed to benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguro/Get.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
// Auto-generated file. DO NOT EDIT!
1818

19-
package benchmarks.immutableList.paguroRrbTree
19+
package benchmarks.immutableList.paguro
2020

2121
import org.openjdk.jmh.annotations.*
2222
import java.util.concurrent.TimeUnit

benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguroRrbTree/Iterate.kt renamed to benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguro/Iterate.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
// Auto-generated file. DO NOT EDIT!
1818

19-
package benchmarks.immutableList.paguroRrbTree
19+
package benchmarks.immutableList.paguro
2020

2121
import org.openjdk.jmh.annotations.*
2222
import java.util.concurrent.TimeUnit

benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguroRrbTree/Remove.kt renamed to benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguro/Remove.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
// Auto-generated file. DO NOT EDIT!
1818

19-
package benchmarks.immutableList.paguroRrbTree
19+
package benchmarks.immutableList.paguro
2020

2121
import org.openjdk.jmh.annotations.*
2222
import java.util.concurrent.TimeUnit

benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguroRrbTree/Set.kt renamed to benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguro/Set.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
// Auto-generated file. DO NOT EDIT!
1818

19-
package benchmarks.immutableList.paguroRrbTree
19+
package benchmarks.immutableList.paguro
2020

2121
import org.openjdk.jmh.annotations.*
2222
import java.util.concurrent.TimeUnit

benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguro/builder/utils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fun persistentListBuilderAdd(size: Int, immutablePercentage: Double): org.organi
2525

2626
var list = org.organicdesign.fp.collections.RrbTree.empty<String>()
2727
repeat(times = immutableSize) {
28-
list = list.append("some element")
28+
list = list.append("another element")
2929
}
3030

3131
val builder = list.mutable()

benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguroRrbTree/utils.kt renamed to benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguro/utils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
// Auto-generated file. DO NOT EDIT!
1818

19-
package benchmarks.immutableList.paguroRrbTree
19+
package benchmarks.immutableList.paguro
2020

2121

2222
fun persistentListAdd(size: Int): org.organicdesign.fp.collections.RrbTree.ImRrbt<String> {

benchmarks-libraries/src/main/kotlin/generators/benchmarkSourceGenerator.kt

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,16 @@ private const val BENCHMARKS_ROOT = "src/jmh/java/"
103103

104104
private val listImpls = listOf(
105105
KotlinListImplementation,
106-
PaguroRrbTreeListImplementation,
106+
PaguroListImplementation,
107107
CyclopsListImplementation,
108108
ClojureListImplementation,
109109
ScalaListImplementation,
110110
VavrListImplementation
111111
)
112112
private val listBuilderImpls = listOf(
113-
ListBuilderKotlinBenchmark(),
114-
ListBuilderPaguroBenchmark(),
115-
ListBuilderClojureBenchmark()
113+
KotlinListBuilderImplementation,
114+
PaguroListBuilderImplementation,
115+
ClojureListBuilderImplementation
116116
)
117117

118118
private val mapImpls = listOf(
@@ -178,13 +178,22 @@ fun generateBenchmarks() {
178178
listImpls.filterIsInstance<ListRemoveBenchmark>().map { ListRemoveBenchmarkGenerator(it) },
179179
listImpls.filterIsInstance<ListSetBenchmark>().map { ListSetBenchmarkGenerator(it) }
180180
)*/
181-
val listBuilderBenchmarks = listOf(
181+
val listBuilderBenchmarks = listBuilderImpls.map { listOf(
182+
ListBuilderAddBenchmarkGenerator(it),
183+
ListBuilderGetBenchmarkGenerator(it),
184+
ListBuilderRemoveBenchmarkGenerator(it),
185+
ListBuilderSetBenchmarkGenerator(it),
186+
ListBuilderUtilsGenerator(it)
187+
) } + listBuilderImpls.filter(ListBuilderImplementation::isIterable).map { listOf(
188+
ListBuilderIterateBenchmarkGenerator(it)
189+
) }
190+
/*listOf(
182191
listBuilderImpls.filterIsInstance<ListBuilderAddBenchmark>().map { ListBuilderAddBenchmarkGenerator(it) },
183192
listBuilderImpls.filterIsInstance<ListBuilderGetBenchmark>().map { ListBuilderGetBenchmarkGenerator(it) },
184193
listBuilderImpls.filterIsInstance<ListBuilderIterateBenchmark>().map { ListBuilderIterateBenchmarkGenerator(it) },
185194
listBuilderImpls.filterIsInstance<ListBuilderRemoveBenchmark>().map { ListBuilderRemoveBenchmarkGenerator(it) },
186195
listBuilderImpls.filterIsInstance<ListBuilderSetBenchmark>().map { ListBuilderSetBenchmarkGenerator(it) }
187-
)
196+
)*/
188197

189198
val mapBenchmarks = listOf(
190199
mapImpls.filterIsInstance<MapGetBenchmark>().map { MapGetBenchmarkGenerator(it) },
@@ -226,8 +235,6 @@ fun generateBenchmarks() {
226235
}
227236

228237
fun generateUtils() {
229-
val listBuilderUtils = listBuilderImpls.filterIsInstance<ListBuilderBenchmarkUtils>().map { ListBuilderUtilsGenerator(it) }
230-
231238
val mapUtils = mapImpls.filterIsInstance<MapBenchmarkUtils>().map { MapUtilsGenerator(it) }
232239
val mapBuilderUtils = mapBuilderImpls.filterIsInstance<MapBuilderBenchmarkUtils>().map { MapBuilderUtilsGenerator(it) }
233240

@@ -239,7 +246,7 @@ fun generateUtils() {
239246
CommonUtilsGenerator()
240247
)
241248

242-
val utils = listBuilderUtils + mapUtils + mapBuilderUtils + setUtils + setBuilderUtils + commonUtils
249+
val utils = mapUtils + mapBuilderUtils + setUtils + setBuilderUtils + commonUtils
243250

244251
utils.forEach { util ->
245252
val path = util.getPackage().replace('.', '/') + "/" + util.outputFileName + ".kt"

0 commit comments

Comments
 (0)