From eaa7c64e41f38e014cee92cad61bc5ccf5992f9e Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 1 Apr 2022 16:08:59 +0200 Subject: [PATCH] update bench --- tests/bench/__init__.py | 1 + tests/bench/notes_table.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 tests/bench/__init__.py diff --git a/tests/bench/__init__.py b/tests/bench/__init__.py new file mode 100644 index 0000000000..3ca53ef96e --- /dev/null +++ b/tests/bench/__init__.py @@ -0,0 +1 @@ +# Simple benchmarks diff --git a/tests/bench/notes_table.py b/tests/bench/notes_table.py index 0803be6eb0..7af261b388 100644 --- a/tests/bench/notes_table.py +++ b/tests/bench/notes_table.py @@ -5,6 +5,7 @@ import time from flask import g from flask_login import login_user +from app.models import FormSemestre from config import RunningConfig as BenchConfig import app @@ -12,10 +13,13 @@ from app import db, create_app from app import clear_scodoc_cache from app.auth.models import get_super_admin from app.scodoc import notesdb as ndb -from app.scodoc import notes_table + +from app.comp.res_compat import NotesTableCompat +from app.comp import res_sem def setup_generator(dept: str): + "setup app" # Setup apptest = create_app(BenchConfig) # Run tests: @@ -39,12 +43,14 @@ def setup_generator(dept: str): def bench_notes_table(dept: str, formsemestre_ids: list[int]) -> float: + "benchmark note stable" for client in setup_generator(dept): tot_time = 0.0 for formsemestre_id in formsemestre_ids: print(f"building sem {formsemestre_id}...") + formsemestre = FormSemestre.query.get(formsemestre_id) t0 = time.time() - nt = notes_table.NotesTable(formsemestre_id) + nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre) tot_time += time.time() - t0 print(f"Total time: {tot_time}") return tot_time