Skip to content

Commit

Permalink
test: updated Performance.kt test
Browse files Browse the repository at this point in the history
  • Loading branch information
waltkb committed Jun 26, 2023
1 parent 96ce508 commit b5b72a0
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/test/kotlin/id/walt/Performance.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,14 @@ import id.walt.signatory.ProofType
import id.walt.signatory.Signatory
import id.walt.test.getTemplate
import io.kotest.core.spec.style.StringSpec
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
import kotlin.system.measureTimeMillis
class Performance : StringSpec({
ServiceMatrix("service-matrix.properties")
val issuerWebDid: String = DidService.create(DidMethod.web)
val issuerWebDid: String = DidService.create(DidMethod.key)
//val credentialService: JwtCredentialService = JwtCredentialService.getService()
val signatory = Signatory.getService()
Expand All @@ -28,13 +25,19 @@ class Performance : StringSpec({
template.issuer = W3CIssuer(issuerWebDid)
template.credentialSubject!!.id = issuerWebDid // self signed
println("Warm up")
repeat(100) {
signatory.issue("VerifiableId", ProofConfig(issuerDid = issuerWebDid, proofType = ProofType.JWT))
}
"Issue 1" {
val jobs = ArrayList<Job>()
repeat(100000) {
println("Starting issuance...")
repeat(1_000_000) {
jobs.add(GlobalScope.launch {
println("" + measureTimeMillis {
signatory.issue("VerifiableId", ProofConfig(issuerDid = issuerWebDid, proofType = ProofType.JWT))
} + " ms")
/*println("" + measureTimeMillis {*/
signatory.issue("VerifiableId", ProofConfig(issuerDid = issuerWebDid, proofType = ProofType.JWT))
/*} + " ms")*/
})
}
Expand Down

0 comments on commit b5b72a0

Please sign in to comment.