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

Code 5

Code 6

Teardown

Results

Fastest

Code 1

138 us

7.23K op/s

Speed

BenchmarkRuntime
Operations
VS
Visual
Code 1138 us7.23K op/s0.00013839430463166884
Code 2345 us2.90K op/s2.5×0.0003448575461173759
Code 6957 us1.05K op/s0.0009569092574766127
Code 32.81 ms356 op/s20×0.0028062723577022552
Code 413.1 ms76.4 op/s95×0.013092278502881527
Code 526.5 ms37.8 op/s191×0.0264852171142896

Memory

BenchmarkPeak Memory
Score
VS
Visual
Code 6< 1 KB11.00
Code 3< 1 KB10.60
Code 2< 1 KB11.50
Code 1< 1 KB11.90
Code 4132 KB7.76132×132
Code 51.43 MB6.421432×1432

Output

Code 1
No output
Code 2
No output
Code 3
No output
Code 4
No output
Code 5
No output
Code 6
No output