0

I am working on an existing Open-Source Android Java App. I have removed the encryption/decryption functions of the App. Now i am using other encryption and decryption functions which are created in a project of my university. I want to compare the performance of my (for example) encryption function with the performance of the encryption function used by the app.

Now i am thinking about the best way to do this. The only idea i have right now is, to do it programmatically and count the time between starting end ending of each function.

I'm looking for a better way to test the performance.

Thanks

Abd El
  • 1

1 Answers1

0

You have kotlin functions typically designed for that, eg: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.system/measure-nano-time.html so you don't even have to code your logic to measure the performance

I see that you tagged "java" and not "kotlin", but you can call your java function in kotlin:

val measure = measureNanoTime(yourJavaFunction())
Log.d(TAG, "time spent: $measure ns")

Edit: your question may be a duplicate of this: https://stackoverflow.com/questions/180158/how-do-i-time-a-methods-execution-in-java

benjiii
  • 413
  • 3
  • 9