From 89278fb44eb99e440b4f92e999addee666e67328 Mon Sep 17 00:00:00 2001 From: lemon24 Date: Mon, 18 Dec 2023 23:28:24 +0200 Subject: [PATCH] Add snippet timing. #327 --- scripts/bench.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/bench.py b/scripts/bench.py index 7dcc13ce..6de80fa9 100644 --- a/scripts/bench.py +++ b/scripts/bench.py @@ -83,6 +83,7 @@ def make_test_client(path): # these get set by the CLI DB_PATH = None QUERY = None +SNIPPET = None LIMIT = 100 SEARCH_LIMIT = 20 @@ -200,6 +201,11 @@ def time_show_100k(client): break +@inject(reader=setup_reader) +def time_snippet(reader): + exec(SNIPPET, {'reader': reader}) + + # there were some update_feeds() timings here (up to 537348c); # I removed them because they relied on fake feeds (also removed in #330), # and I didn't want to spend the time to find another way of doing it @@ -287,6 +293,13 @@ def reset(): expose_value=False, help="search_entries() query.", )(fn) + click.option( + '--snippet', + show_default=True, + callback=set_global, + expose_value=False, + help="Python snippet.", + )(fn) return fn