Skip to content

Commit

Permalink
Adds event factory performance test
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorpamplona committed Aug 6, 2024
1 parent dee28f3 commit 71b45b9
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.vitorpamplona.quartz.crypto.CryptoUtils
import com.vitorpamplona.quartz.encoders.Nip01Serializer
import com.vitorpamplona.quartz.events.Event
import com.vitorpamplona.quartz.events.EventFactory
import com.vitorpamplona.quartz.utils.TimeUtils
import junit.framework.TestCase.assertNotNull
import junit.framework.TestCase.assertTrue
import org.junit.Rule
Expand Down Expand Up @@ -246,4 +248,13 @@ class EventBenchmark {
serializer.escapeStringInto(specialEncoders, Nip01Serializer.BufferedDigestWriter(MessageDigest.getInstance("SHA-256")))
}
}

@Test
fun eventFactoryPerformanceTest() {
val now = TimeUtils.now()
val tags = arrayOf(arrayOf(""))
benchmarkRule.measureRepeated {
EventFactory.create("id", "pubkey", now, 1, tags, "content", "sig")
}
}
}

0 comments on commit 71b45b9

Please sign in to comment.