import numpy as np
import perfplot
from rithm._crithm import Int, Int2
perfplot.show(
setup=lambda n: list(
zip(
*[
(Int(raw), Int2(raw))
for raw in np.random.randint(-(10**6), 10**6, n)
]
)
),
kernels=[
lambda a: sum(a[0]),
lambda a: sum(a[1]),
],
labels=['old', 'new'],
n_range=[2**k for k in range(25)],
xlabel='len(a)',
# More optional arguments with their default values:
# logx="auto", # set to True or False to force scaling
# logy="auto",
# equality_check=np.allclose, # set to None to disable "correctness" assertion
equality_check=None,
# show_progress=True,
# target_time_per_measurement=1.0,
# max_time=None, # maximum time per measurement
# time_unit="s", # set to one of ("auto", "s", "ms", "us", or "ns") to force plot units
# relative_to=1, # plot the timings relative to one of the measurements
# flops=lambda n: 3*n, # FLOPS plots
)