Adds event factory performance test

This commit is contained in:
Vitor Pamplona
2024-08-06 11:04:30 -04:00
parent dee28f3aa8
commit 71b45b96fb

View File

@@ -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
@@ -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")
}
}
}