Benchmark Python Snippets Online

Perfpy allows you to benchmark python snippets online and share them with other people. You can measure the performance and memory usage of code on different python versions in this sandbox environment.

The tool can compare and test the speed of 3rd-party libraries or library versions, so you can find out which is the fastest or consumes less memory between numpy, opencv, scipy and pandas for a certain function.

Packages

Setup

Runs before the benchmark, and it is not measured. Good place to import libraries and prepare data. Learn more

Code 1

Code 2

Code 3

Code 4

Teardown

Results

Fastest

sequential

17.3 ms

57.9 op/s

Speed

BenchmarkRuntime
Operations
VS
Visual
sequential17.3 ms57.9 op/s0.017263421167929966
await sequential18.6 ms53.7 op/s1.08×0.018638089299201965
gather batch(100)228 ms4.39 op/s13×0.2280491590499878
gather230 ms4.34 op/s13×0.2304191216826439

Memory

BenchmarkPeak Memory
Score
VS
Visual
sequential< 1 KB9.760
await sequential< 1 KB9.730
gather batch(100)4.06 MB5.034060×4060
gather10.5 MB4.6110544×10544

Output

gather
No output
await sequential
No output
sequential
Error: Exec command 3d2f6a51076fd04337f40408d7c26af06efa6b65a67301b2b40c3882e240fa56 is already running
gather batch(100)
No output