Reverse String
Performance Benchmarking
Running benchmarking tests on the Devnet will not yield satisfactory results; you need a full-scale network for that purpose.
The contract MpBenchmarking is designed to benchmark the reverse function using different numbers of processes in parallel.
The reverse function in the contract takes a bytes array as input and reverses its contents. Finally, it calculates the keccak256
hash of the reversed array. The execution time for each thread count (1, 2, 4, 8, 12, 16, 32, 64) was recorded for each of the 10 runs. Statistics (min, max, mean, and standard deviation) were extracted from the result data.
Results (ms):
1 | 2 | 4 | 8 | 12 | 16 | 32 | 64 |
---|---|---|---|---|---|---|---|
806 | 481 | 222 | 120 | 125 | 76 | 58 | 3 |
806 | 428 | 255 | 129 | 106 | 76 | 58 | 58 |
840 | 408 | 273 | 130 | 138 | 102 | 70 | 38 |
884 | 470 | 216 | 149 | 95 | 78 | 57 | 61 |
792 | 468 | 219 | 136 | 120 | 84 | 53 | 79 |
851 | 408 | 230 | 119 | 88 | 87 | 62 | 84 |
808 | 460 | 211 | 115 | 100 | 95 | 66 | 38 |
891 | 419 | 223 | 166 | 119 | 76 | 79 | 65 |
832 | 426 | 287 | 150 | 85 | 69 | 56 | 40 |
793 | 458 | 233 | 120 | 124 | 91 | 56 | 41 |
Analysis:
Test case Decreasing Execution Time with Increasing Threads: As the number of threads increases, the execution time generally decreases. This trend is evident across the different thread counts. It suggests that the benchmark benefits from parallelization, and as more threads are utilized, the computation becomes more efficient. While increasing the number of threads initially leads to significant reductions in execution time, the rate of improvement starts to slow down as the number of threads increases.
Given that the test machine only has 32 physical cores, adding more threads beyond 32 (e.g., comparing 32 threads and 64 threads) is unlikely to result in significant improvements in performance for this specific benchmark.
Last updated