Skip to content

Commit

Permalink
tests: refactor perf tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Clarmy committed Jun 13, 2023
1 parent 8237a7a commit 4d6012e
Showing 1 changed file with 45 additions and 30 deletions.
75 changes: 45 additions & 30 deletions tests/test_perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,135 +10,150 @@


def test_calc_mae_1e3(benchmark):
obs = np.random.rand(int(1e3))
fct = np.random.rand(int(1e3))

def inner():
obs = np.random.rand(int(1e3))
fct = np.random.rand(int(1e3))
calc_mae(obs, fct)

benchmark(inner)


def test_calc_mae_1e6(benchmark):
obs = np.random.rand(int(1e6))
fct = np.random.rand(int(1e6))

def inner():
obs = np.random.rand(int(1e6))
fct = np.random.rand(int(1e6))
calc_mae(obs, fct)

benchmark(inner)


def test_calc_mae_1e7(benchmark):
obs = np.random.rand(int(1e7))
fct = np.random.rand(int(1e7))

def inner():
obs = np.random.rand(int(1e7))
fct = np.random.rand(int(1e7))
calc_mae(obs, fct)

benchmark(inner)


def test_calc_mbe_1e3(benchmark):
obs = np.random.rand(int(1e3))
fct = np.random.rand(int(1e3))

def inner():
obs = np.random.rand(int(1e3))
fct = np.random.rand(int(1e3))
calc_mbe(obs, fct)

benchmark(inner)


def test_calc_mbe_1e6(benchmark):
obs = np.random.rand(int(1e6))
fct = np.random.rand(int(1e6))

def inner():
obs = np.random.rand(int(1e6))
fct = np.random.rand(int(1e6))
calc_mbe(obs, fct)

benchmark(inner)


def test_calc_mbe_1e7(benchmark):
obs = np.random.rand(int(1e7))
fct = np.random.rand(int(1e7))

def inner():
obs = np.random.rand(int(1e7))
fct = np.random.rand(int(1e7))
calc_mbe(obs, fct)

benchmark(inner)


def test_calc_threshold_hit_ratio_1e3(benchmark):
obs = np.random.rand(int(1e3))
fct = np.random.rand(int(1e3))

def inner():
obs = np.random.rand(int(1e3))
fct = np.random.rand(int(1e3))
calc_threshold_hit_ratio(obs, fct, 0.5)

benchmark(inner)


def test_calc_threshold_hit_ratio_1e6(benchmark):
obs = np.random.rand(int(1e6))
fct = np.random.rand(int(1e6))

def inner():
obs = np.random.rand(int(1e6))
fct = np.random.rand(int(1e6))
calc_threshold_hit_ratio(obs, fct, 0.5)

benchmark(inner)


def test_calc_threshold_hit_ratio_1e7(benchmark):
obs = np.random.rand(int(1e7))
fct = np.random.rand(int(1e7))

def inner():
obs = np.random.rand(int(1e7))
fct = np.random.rand(int(1e7))
calc_threshold_hit_ratio(obs, fct, 0.5)

benchmark(inner)


def test_calc_threshold_false_alarm_ratio_1e3(benchmark):
obs = np.random.rand(int(1e3))
fct = np.random.rand(int(1e3))

def inner():
obs = np.random.rand(int(1e3))
fct = np.random.rand(int(1e3))
calc_threshold_false_alarm_ratio(obs, fct, 0.5)

benchmark(inner)


def test_calc_threshold_false_alarm_ratio_1e6(benchmark):
obs = np.random.rand(int(1e6))
fct = np.random.rand(int(1e6))

def inner():
obs = np.random.rand(int(1e6))
fct = np.random.rand(int(1e6))
calc_threshold_false_alarm_ratio(obs, fct, 0.5)

benchmark(inner)


def test_calc_threshold_false_alarm_ratio_1e7(benchmark):
obs = np.random.rand(int(1e7))
fct = np.random.rand(int(1e7))

def inner():
obs = np.random.rand(int(1e7))
fct = np.random.rand(int(1e7))
calc_threshold_false_alarm_ratio(obs, fct, 0.5)

benchmark(inner)


def test_calc_threshold_ts_1e3(benchmark):
obs = np.random.rand(int(1e3))
fct = np.random.rand(int(1e3))

def inner():
obs = np.random.rand(int(1e3))
fct = np.random.rand(int(1e3))
calc_threshold_ts(obs, fct, 0.5)

benchmark(inner)


def test_calc_threshold_ts_1e6(benchmark):
obs = np.random.rand(int(1e6))
fct = np.random.rand(int(1e6))

def inner():
obs = np.random.rand(int(1e6))
fct = np.random.rand(int(1e6))
calc_threshold_ts(obs, fct, 0.5)

benchmark(inner)


def test_calc_threshold_ts_1e7(benchmark):
obs = np.random.rand(int(1e7))
fct = np.random.rand(int(1e7))

def inner():
obs = np.random.rand(int(1e7))
fct = np.random.rand(int(1e7))
calc_threshold_ts(obs, fct, 0.5)

benchmark(inner)

0 comments on commit 4d6012e

Please sign in to comment.