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

Code 1

Code 2

Code 3

Code 4

Teardown

Results

There was an error with one of your snippets. Check the output below for more information.

Fastest

Code 2

160 ns

6.25M op/s

Speed

BenchmarkRuntime
Operations
VS
Visual
Code 2160 ns6.25M op/s1.6004439792326357e-7
Code 3170 ns5.87M op/s1.07×1.7049647610254385e-7
Code 1173 ns5.80M op/s1.08×1.725305718820204e-7

Memory

BenchmarkPeak Memory
Score
VS
Visual
Code 3< 1 KB14.80
Code 2< 1 KB14.80
Code 1< 1 KB14.80

Output

Code 1
No output
Code 2
No output
Code 3
No output
Code 4
NameError: name 'o' is not defined