Skip to content

Commit

Permalink
ref(test): Rename memory function
Browse files Browse the repository at this point in the history
To `benchmark`
  • Loading branch information
Iamlooker committed Jan 3, 2025
1 parent c3ed004 commit c77dba8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.looker.sync.fdroid.common.Izzy
import com.looker.sync.fdroid.common.JsonParser
import com.looker.sync.fdroid.common.assets
import com.looker.sync.fdroid.common.downloadIndex
import com.looker.sync.fdroid.common.memory
import com.looker.sync.fdroid.common.benchmark
import com.looker.sync.fdroid.v2.EntryParser
import com.looker.sync.fdroid.v2.EntrySyncable
import com.looker.sync.fdroid.v2.model.Entry
Expand Down Expand Up @@ -55,15 +55,15 @@ class EntrySyncableTest {

@Test
fun benchmark_sync_full() = runTest(dispatcher) {
val output = memory(10) {
val output = benchmark(10) {
measureTimeMillis { syncable.sync(repo) }
}
println(output)
}

@Test
fun benchmark_entry_parser() = runTest(dispatcher) {
val output = memory(10) {
val output = benchmark(10) {
measureTimeMillis {
parser.parse(
file = FakeDownloader.downloadIndex(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.looker.sync.fdroid.common.IndexJarValidator
import com.looker.sync.fdroid.common.Izzy
import com.looker.sync.fdroid.common.JsonParser
import com.looker.sync.fdroid.common.downloadIndex
import com.looker.sync.fdroid.common.memory
import com.looker.sync.fdroid.common.benchmark
import com.looker.sync.fdroid.common.toV2
import com.looker.sync.fdroid.v1.V1Parser
import com.looker.sync.fdroid.v1.V1Syncable
Expand Down Expand Up @@ -53,7 +53,7 @@ class V1SyncableTest {

@Test
fun benchmark_sync_v1() = runTest(dispatcher) {
val output = memory(10) {
val output = benchmark(10) {
measureTimeMillis { syncable.sync(repo) }
}
println(output)
Expand All @@ -62,7 +62,7 @@ class V1SyncableTest {
@Test
fun benchmark_v1_parser() = runTest(dispatcher) {
val file = FakeDownloader.downloadIndex(context, repo, "izzy", "index-v1.jar")
val output = memory(10) {
val output = benchmark(10) {
measureTimeMillis {
parser.parse(
file = file,
Expand All @@ -77,15 +77,15 @@ class V1SyncableTest {
fun benchmark_v1_vs_v2_parser() = runTest(dispatcher) {
val v1File = FakeDownloader.downloadIndex(context, repo, "izzy-v1", "index-v1.jar")
val v2File = FakeDownloader.downloadIndex(context, repo, "izzy-v2", "index-v2.json")
val output1 = memory(10) {
val output1 = benchmark(10) {
measureTimeMillis {
parser.parse(
file = v1File,
repo = repo
)
}
}
val output2 = memory(10) {
val output2 = benchmark(10) {
measureTimeMillis {
v2Parser.parse(
file = v2File,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.looker.sync.fdroid.common
import kotlin.math.pow
import kotlin.math.sqrt

internal inline fun memory(
internal inline fun benchmark(
repetition: Int,
extraMessage: String? = null,
block: () -> Long,
Expand Down

0 comments on commit c77dba8

Please sign in to comment.