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

List packages as it's done in a requirements.txt file. Learn more

Setup

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

Code 1

Code 2

Teardown

Results

Fastest

Code 1

5.62 ms

178 op/s

Speed

BenchmarkRuntime
Operations
VS
Visual
Code 15.62 ms178 op/s0.005624627073605855
Code 2545 ms1.83 op/s97×0.5454173739999533

Memory

BenchmarkPeak Memory
Score
VS
Visual
Code 124.0 MB5.8723956
Code 280.0 MB3.363.3×80028

Output

Code 1
Using NumPy took: 0.029782533645629883 seconds
Code 2
Using loop took: 0.5657362937927246 seconds