add temporary benchmark for updateReqs

This commit is contained in:
Damien Elmes 2019-12-24 10:23:21 +10:00
parent b67b1e1451
commit f7dfe98030

View File

@ -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)