Skip to content

Commit

Permalink
Add snippet timing. #327
Browse files Browse the repository at this point in the history
  • Loading branch information
lemon24 committed Dec 18, 2023
1 parent f0b692e commit 89278fb
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions scripts/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 89278fb

Please sign in to comment.