-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Support mutable locations (#295)
[jacodb-core] Minor: reduce number of downloads Two versions of the Keap lib are downloaded twice, not three times. [jacodb-core] Make code model with ERS backend mutable incremental As of this commit, ErsPersistenceImpl has got the following additional features: - For any location and class name, there can exist several entities. - Amongst those entities, only one is active (current), other are logically deleted, i.e. marked with "isDeleted" property. - Any location identified by its id can be forced to be re-indexed. Only changed classes are getting the new version during re-indexing. - For binding Persistence layer with the layer of JcDatabase, a new ClassSource implementation introduced. For getting class' byte code, this implementation checks if class id which it holds is up-to-date. - Code model re-indexes changed locations after JcDatabase.refresh() is invoked. TODO. PersistentLocationsRegistry looks overcomplicated. JcLocation implementations look as hacks in order to get JcLocation.isChanged() working, and in order to reindex mutated locations in-place without adding/removing them. So this part looks as a good candidate for complete rewriting. [jacodb-core] Ensure that jar file is closed Two resource leaks fixed: a jar file wasn't closed after - its hash was computed; - its classes were indexed.
- Loading branch information
Showing
16 changed files
with
412 additions
and
115 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
91 changes: 91 additions & 0 deletions
91
jacodb-benchmarks/src/test/kotlin/org/jacodb/testing/performance/hash/HashBenchmarks.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,91 @@ | ||
/* | ||
* Copyright 2022 UnitTestBot contributors (utbot.org) | ||
* <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 | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* 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. | ||
*/ | ||
|
||
@file:Suppress("UnstableApiUsage", "DEPRECATION") | ||
|
||
package org.jacodb.testing.performance.hash | ||
|
||
import com.google.common.hash.Hasher | ||
import com.google.common.hash.Hashing | ||
import kotlinx.benchmark.Benchmark | ||
import org.openjdk.jmh.annotations.BenchmarkMode | ||
import org.openjdk.jmh.annotations.Measurement | ||
import org.openjdk.jmh.annotations.Mode | ||
import org.openjdk.jmh.annotations.OutputTimeUnit | ||
import org.openjdk.jmh.annotations.Scope | ||
import org.openjdk.jmh.annotations.State | ||
import org.openjdk.jmh.annotations.Warmup | ||
import java.security.SecureRandom | ||
import java.util.concurrent.TimeUnit | ||
|
||
@State(Scope.Benchmark) | ||
@Warmup(iterations = 2, time = 1) | ||
@BenchmarkMode(Mode.AverageTime) | ||
@Measurement(iterations = 5, time = 1) | ||
class HashBenchmarks { | ||
|
||
companion object { | ||
val array = ByteArray(1_000_000).also { SecureRandom().nextBytes(it) } | ||
} | ||
|
||
@Benchmark | ||
@OutputTimeUnit(TimeUnit.NANOSECONDS) | ||
fun createSip24Hasher(): Hasher { | ||
return Hashing.sipHash24().newHasher() | ||
} | ||
|
||
@Benchmark | ||
@OutputTimeUnit(TimeUnit.NANOSECONDS) | ||
fun createMurMur3Hasher(): Hasher { | ||
return Hashing.murmur3_128().newHasher() | ||
} | ||
|
||
@Benchmark | ||
@OutputTimeUnit(TimeUnit.NANOSECONDS) | ||
fun createMd5Hasher(): Hasher { | ||
return Hashing.md5().newHasher() | ||
} | ||
|
||
@Benchmark | ||
@OutputTimeUnit(TimeUnit.NANOSECONDS) | ||
fun createSha256Hasher(): Hasher { | ||
return Hashing.sha256().newHasher() | ||
} | ||
|
||
@Benchmark | ||
@OutputTimeUnit(TimeUnit.MICROSECONDS) | ||
fun sip24Hash(): Long { | ||
return Hashing.sipHash24().newHasher().putBytes(array).hash().asLong() | ||
} | ||
|
||
@Benchmark | ||
@OutputTimeUnit(TimeUnit.MICROSECONDS) | ||
fun murMur3Hash(): Long { | ||
return Hashing.murmur3_128().newHasher().putBytes(array).hash().asLong() | ||
} | ||
|
||
@Benchmark | ||
@OutputTimeUnit(TimeUnit.MICROSECONDS) | ||
fun sha256Hash(): Long { | ||
return Hashing.sha256().newHasher().putBytes(array).hash().asLong() | ||
} | ||
|
||
@Benchmark | ||
@OutputTimeUnit(TimeUnit.MICROSECONDS) | ||
fun md5Hash(): Long { | ||
return Hashing.md5().newHasher().putBytes(array).hash().asLong() | ||
} | ||
} |
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
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
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
Oops, something went wrong.