add benchmarks/arrayToQPath.py
This commit is contained in:
parent
0d8eba36a6
commit
fa826bd4cb
30
benchmarks/arrayToQPath.py
Normal file
30
benchmarks/arrayToQPath.py
Normal file
@ -0,0 +1,30 @@
|
||||
import numpy as np
|
||||
import pyqtgraph as pg
|
||||
|
||||
rng = np.random.default_rng(12345)
|
||||
|
||||
class _TimeSuite:
|
||||
params = ([10_000, 100_000, 1_000_000], ['all', 'finite', 'pairs', 'array'])
|
||||
|
||||
def setup(self, nelems, connect):
|
||||
self.xdata = np.arange(nelems, dtype=np.float64)
|
||||
self.ydata = rng.standard_normal(nelems, dtype=np.float64)
|
||||
if connect == 'array':
|
||||
self.connect_array = np.ones(nelems, dtype=bool)
|
||||
if self.have_nonfinite:
|
||||
self.ydata[::5000] = np.nan
|
||||
|
||||
def time_test(self, nelems, connect):
|
||||
if connect == 'array':
|
||||
connect = self.connect_array
|
||||
pg.arrayToQPath(self.xdata, self.ydata, connect=connect)
|
||||
|
||||
class TimeSuiteAllFinite(_TimeSuite):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.have_nonfinite = False
|
||||
|
||||
class TimeSuiteWithNonFinite(_TimeSuite):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.have_nonfinite = True
|
Loading…
x
Reference in New Issue
Block a user