Commit 2a05f05f authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

tests/bench: Add tests for various ways to pass function args.

Passing 3 args with keywords is for example 50% slower than via positional
args.
parent 16951512
import bench
def func(a):
pass
def test(num):
for i in iter(range(num)):
func(i)
bench.run(test)
import bench
def func(a, b, c):
pass
def test(num):
for i in iter(range(num)):
func(i, i, i)
bench.run(test)
import bench
def func(a, b=1, c=2):
pass
def test(num):
for i in iter(range(num)):
func(i)
bench.run(test)
import bench
def func(a):
pass
def test(num):
for i in iter(range(num)):
func(a=i)
bench.run(test)
import bench
def func(a, b, c):
pass
def test(num):
for i in iter(range(num)):
func(c=i, b=i, a=i)
bench.run(test)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment