forked from ScoDoc/DocScoDoc
Merge branch 'master' of https://scodoc.org/git/viennet/ScoDoc
This commit is contained in:
commit
e270ad5520
1
tests/bench/__init__.py
Normal file
1
tests/bench/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
# Simple benchmarks
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user