I checked that property testing is really slow in ...
# kotest
j
I checked that property testing is really slow in KMP compared to JVM. Not sure if this is caused by Kotest or just because KMP tests are slow and property testing is running a lot iterations (probably this last one). Any way to improve it? I tried 100k iterations and it was running under 30 secs in jvm, but in other native target is taking over 2 or 3 minutes
s
The JS runtime is going to be slower than the JVM runtime.
j
Then the problem is not caused by native, only js?
Interesting
s
Well I'm just guessing. I can't imagine running mocha or karma is faster than the jvm
w
Maybe you can try running roughly the same code but in a manual for-loop, with minimal amount of Kotest, and compare the results? That’s how I found some performance issues with the old property testing back couple of months ago (nested `foreach`es with the same code ran much faster than nested `forAll`s)
đź‘€ 1
s
Foreach was faster? Because it wasn't creating tests?
w
I think it the performance cost was figuring out the test name, it used reflection to read the parameters names in the lambda passed to
forAll
, and they weren’t cached in any way so the cost was paid for each iteration
s
Oh nice spot
I'll create a ticket for that
w
Thanks 🙂 I don’t remember why I haven’t reported it back then 🤔 Also I saw some new APIs for those tests that didn’t need reflection?
s
Yep