Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AndroidCLI/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ android {
namespace = "com.bloomberg.selekt.cli"
defaultConfig {
applicationId = "com.bloomberg.selekt.cli"
minSdk = 21
minSdk = 26
targetSdk = 34
versionCode = 1
versionName = "0.1"
Expand Down
2 changes: 1 addition & 1 deletion AndroidLibBenchmark/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ android {
buildToolsVersion("34.0.0")
namespace = "com.bloomberg.selekt.android.benchmark"
defaultConfig {
minSdkVersion(21)
minSdkVersion(26)
targetSdkVersion(34)
testInstrumentationRunner = "androidx.benchmark.junit4.AndroidBenchmarkRunner"
testInstrumentationRunnerArguments.putAll(arrayOf(
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ koverReport {
verify {
rule("Minimal coverage") {
bound {
minValue = 96
minValue = 95
aggregation = AggregationType.COVERED_PERCENTAGE
}
}
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
selekt.versionName=0.25.2
selekt.nextVersionName=0.26.0
selekt.versionName=0.26.0
selekt.nextVersionName=0.27.0

openssl.version=3.1.2
openssl.sha256=a0ce69b8b97ea6a35b96875235aa453b966ba3cba8af2de23657d8b6767d6539
Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ cash-licensee = { id = "app.cash.licensee", version = "1.6.0" }
detekt = { id = "io.gitlab.arturbosch.detekt", version = "1.22.0" }
dokka = { id = "org.jetbrains.dokka", version = "1.9.20" }
ideaExt = { id = "org.jetbrains.gradle.plugin.idea-ext", version = "1.1.7" }
jmh = { id = "me.champeau.jmh", version = "0.7.3" }
kover = { id = "org.jetbrains.kotlinx.kover", version = "0.7.6" }
ksp = { id = "com.google.devtools.ksp", version = "2.0.20-1.0.24" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version = "11.5.0" }
Expand Down
2 changes: 1 addition & 1 deletion selekt-android-sqlcipher/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ android {
namespace = "com.bloomberg.selekt.android.sqlcipher"
ndkVersion = "27.3.13750724"
defaultConfig {
minSdk = 21
minSdk = 26
@Suppress("UnstableApiUsage")
externalNativeBuild {
cmake {
Expand Down
2 changes: 1 addition & 1 deletion selekt-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ android {
buildToolsVersion = "34.0.0"
namespace = "com.bloomberg.selekt.android"
defaultConfig {
minSdk = 21
minSdk = 26
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
9 changes: 8 additions & 1 deletion selekt-java/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ repositories {

plugins {
kotlin("jvm")
alias(libs.plugins.ksp)
id("com.android.lint")
alias(libs.plugins.kover)
alias(libs.plugins.dokka)
`maven-publish`
signing
alias(libs.plugins.jmh)
alias(libs.plugins.detekt)
alias(libs.plugins.ktlint)
}
Expand Down Expand Up @@ -58,6 +58,13 @@ val integrationTestRuntimeOnly: Configuration by configurations.getting {
dependencies {
implementation(projects.selektApi)
implementation(projects.selektSqlite3Classes)
jmhImplementation(libs.kotlinx.coroutines.core)
}

jmh {
if (hasProperty("jmh.includes")) {
includes.add(property("jmh.includes").toString())
}
}

publishing {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright 2024 Bloomberg Finance L.P.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.bloomberg.selekt.cache.benchmarks;

import com.bloomberg.selekt.cache.LruCache;
import org.jetbrains.annotations.NotNull;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;

public class LruCacheBenchmark {
@State(Scope.Thread)
public static class CacheInput {
LruCache<Object> cache;

@Setup(Level.Iteration)
public void setUp() {
cache = new LruCache<>(1, obj -> kotlin.Unit.INSTANCE);
}
}
@Benchmark
@BenchmarkMode(Mode.Throughput)
public Object getEntry(@NotNull final CacheInput input) {
return input.cache.get("1", Object::new);
}

@Benchmark
@BenchmarkMode(Mode.Throughput)
public Object getEntryWithEviction(@NotNull final CacheInput input) {
input.cache.get("1", Object::new);
return input.cache.get("2", Object::new);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 2020 Bloomberg Finance L.P.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.bloomberg.selekt.pools.benchmarks;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

public final class BenchmarkExecutors {
private BenchmarkExecutors() {
throw new AssertionError("Instantiation of the utility class " + BenchmarkExecutors.class.getName() +
" is not allowed.");
}

static final ScheduledExecutorService sharedExecutor = Executors.newSingleThreadScheduledExecutor(r -> {
Thread thread = new Thread(r);
thread.setDaemon(true);
thread.setPriority(Thread.MIN_PRIORITY);
return thread;
});
}
Loading