Created
December 14, 2019 19:07
-
-
Save bholota/31596addd88fc443dc257d69eaba24bd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val benchmarkList = List<ProducerConsumerCoroutinesOnlyBenchmark>(100) { ProducerConsumerCoroutinesOnlyBenchmark() } | |
launch { | |
val resultList = benchmarkList.map { | |
it.startBenchmark() | |
} | |
val resultReduced = resultList.reduce {sum, element -> | |
ProducerConsumerCoroutinesOnlyBenchmark.Result(sum.executionTime + element.executionTime, sum.numOfReceivedMessages + element.numOfReceivedMessages) | |
} | |
Log.d("FragmentCoroutinesDemo", "Result not reduced " + resultReduced.executionTime + "ms") | |
onBenchmarkCompleted(ProducerConsumerCoroutinesOnlyBenchmark.Result(resultReduced.executionTime / 100, resultReduced.numOfReceivedMessages / 100)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment