change(mkpkglists): converted to use aurweb.db ORM

- Improved speed dramatically
- Removed mkpkglists sharness

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-11-21 00:47:48 -08:00
parent c59acbf6d6
commit 29c2d0de6b
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
4 changed files with 403 additions and 180 deletions

21
aurweb/benchmark.py Normal file
View file

@ -0,0 +1,21 @@
from datetime import datetime
class Benchmark:
def __init__(self):
self.start()
def _timestamp(self) -> float:
""" Generate a timestamp. """
return float(datetime.utcnow().timestamp())
def start(self) -> int:
""" Start a benchmark. """
self.current = self._timestamp()
return self.current
def end(self):
""" Return the diff between now - start(). """
n = self._timestamp() - self.current
self.current = float(0)
return n