Skip to content

Commit 86cc083

Browse files
author
Abduqodiri Qurbonzoda
committed
Add paguro map and mapBuilder benchmarks
1 parent 983c25d commit 86cc083

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1030
-51
lines changed

benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguro/Add.kt renamed to benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguroRrbTree/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.paguro
19+
package benchmarks.immutableList.paguroRrbTree
2020

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

benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguro/Get.kt renamed to benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguroRrbTree/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.paguro
19+
package benchmarks.immutableList.paguroRrbTree
2020

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

benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguro/Iterate.kt renamed to benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguroRrbTree/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.paguro
19+
package benchmarks.immutableList.paguroRrbTree
2020

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

benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguro/Remove.kt renamed to benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguroRrbTree/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.paguro
19+
package benchmarks.immutableList.paguroRrbTree
2020

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

benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguro/Set.kt renamed to benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguroRrbTree/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.paguro
19+
package benchmarks.immutableList.paguroRrbTree
2020

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

benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguro/utils.kt renamed to benchmarks-libraries/src/jmh/java/benchmarks/immutableList/paguroRrbTree/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.paguro
19+
package benchmarks.immutableList.paguroRrbTree
2020

2121

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

benchmarks-libraries/src/jmh/java/benchmarks/immutableMap/capsule/utils.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818

1919
package benchmarks.immutableMap.capsule
2020

21+
import benchmarks.IntWrapper
2122

22-
fun <K> persistentMapPut(keys: List<K>): io.usethesource.capsule.Map.Immutable<K, String> {
23-
var map = io.usethesource.capsule.core.PersistentTrieMap.of<K, String>()
23+
fun persistentMapPut(keys: List<IntWrapper>): io.usethesource.capsule.Map.Immutable<IntWrapper, String> {
24+
var map = io.usethesource.capsule.core.PersistentTrieMap.of<IntWrapper, String>()
2425
for (key in keys) {
2526
map = map.__put(key, "some element")
2627
}

benchmarks-libraries/src/jmh/java/benchmarks/immutableMap/kotlin/utils.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818

1919
package benchmarks.immutableMap.kotlin
2020

21+
import benchmarks.IntWrapper
2122

22-
fun <K> persistentMapPut(keys: List<K>): kotlinx.collections.immutable.PersistentMap<K, String> {
23-
var map = kotlinx.collections.immutable.persistentHashMapOf<K, String>()
23+
fun persistentMapPut(keys: List<IntWrapper>): kotlinx.collections.immutable.PersistentMap<IntWrapper, String> {
24+
var map = kotlinx.collections.immutable.persistentHashMapOf<IntWrapper, String>()
2425
for (key in keys) {
2526
map = map.put(key, "some element")
2627
}

benchmarks-libraries/src/jmh/java/benchmarks/immutableMap/kotlinOrdered/utils.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818

1919
package benchmarks.immutableMap.kotlinOrdered
2020

21+
import benchmarks.IntWrapper
2122

22-
fun <K> persistentMapPut(keys: List<K>): kotlinx.collections.immutable.PersistentMap<K, String> {
23-
var map = kotlinx.collections.immutable.persistentMapOf<K, String>()
23+
fun persistentMapPut(keys: List<IntWrapper>): kotlinx.collections.immutable.PersistentMap<IntWrapper, String> {
24+
var map = kotlinx.collections.immutable.persistentMapOf<IntWrapper, String>()
2425
for (key in keys) {
2526
map = map.put(key, "some element")
2627
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright 2016-2019 JetBrains s.r.o.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// Auto-generated file. DO NOT EDIT!
18+
19+
package benchmarks.immutableMap.paguro
20+
21+
import org.openjdk.jmh.annotations.*
22+
import java.util.concurrent.TimeUnit
23+
import org.openjdk.jmh.infra.Blackhole
24+
import benchmarks.*
25+
26+
@Fork(1)
27+
@Warmup(iterations = 5)
28+
@Measurement(iterations = 5)
29+
@BenchmarkMode(Mode.AverageTime)
30+
@OutputTimeUnit(TimeUnit.MICROSECONDS)
31+
@State(Scope.Thread)
32+
open class Get {
33+
@Param("10000", "100000")
34+
var size: Int = 0
35+
36+
@Param(ASCENDING_HASH_CODE, RANDOM_HASH_CODE, COLLISION_HASH_CODE, NON_EXISTING_HASH_CODE)
37+
var hashCodeType = ""
38+
39+
private var keys = listOf<IntWrapper>()
40+
private var persistentMap = org.organicdesign.fp.collections.PersistentHashMap.empty<IntWrapper, String>()
41+
42+
@Setup(Level.Trial)
43+
fun prepare() {
44+
keys = generateKeys(hashCodeType, size)
45+
persistentMap = persistentMapPut(keys)
46+
47+
if (hashCodeType == NON_EXISTING_HASH_CODE)
48+
keys = generateKeys(hashCodeType, size)
49+
50+
}
51+
52+
@Benchmark
53+
fun get(bh: Blackhole) {
54+
repeat(times = size) { index ->
55+
bh.consume(persistentMap[keys[index]])
56+
}
57+
}
58+
}

0 commit comments

Comments
 (0)