From f7dfe9803076968f7343b3e614803ee232238417 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 24 Dec 2019 10:23:21 +1000 Subject: [PATCH] add temporary benchmark for updateReqs --- tests/test_models.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/test_models.py b/tests/test_models.py index 971ec02ca..9df8f7ef6 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -361,3 +361,18 @@ def test_req(): opt['tmpls'][1]['qfmt'] = "{{^Add Reverse}}{{Back}}{{/Add Reverse}}" mm.save(opt, templates=True) assert opt['req'][1] == [1, 'none', []] + +def test_updatereqs_performance(): + import time + d = getEmptyCol() + mm = d.models + m = mm.byName("Basic") + for i in range(100): + fld = mm.newField(f"field{i}") + mm.addField(m, fld) + tmpl = mm.newTemplate(f"template{i}") + tmpl['qfmt'] = "{{field%s}}" % i + mm.addTemplate(m, tmpl) + t = time.time() + mm.save(m, templates=True) + print("took", (time.time()-t)*100) \ No newline at end of file