An open source, non-profit web search engine
Use a separate page size for testing
Daoud Clarkec84eeba92e53
diff --git a/performance.py b/performance.pyindex 2d4280d..3376198 100644--- a/performance.py+++ b/performance.py@@ -1,23 +1,23 @@"""Test the performance of the search in terms of compression and speed."""-import json-import numpy as npimport osfrom datetime import datetimefrom itertools import islice+import numpy as npfrom spacy.lang.en import Englishfrom starlette.testclient import TestClient-from app import app, complete-from index import TinyIndexer, index_titles_and_urls, PAGE_SIZE, NUM_PAGES+from app import app+from index import TinyIndexer, index_titles_and_urlsfrom paths import TEST_INDEX_PATHfrom wiki import get_wiki_titles_and_urls-NUM_DOCUMENTS = 30000NUM_PAGES_FOR_STATS = 10+TEST_PAGE_SIZE = 512+TEST_NUM_PAGES = 32def query_test():@@ -43,7 +43,7 @@ def query_test():def page_stats(indexer: TinyIndexer):page_sizes = []- for i in range(NUM_PAGES):+ for i in range(TEST_NUM_PAGES):page = indexer.get_page(i)if page is not None:page_sizes.append(len(page))@@ -57,7 +57,7 @@ def performance_test():os.remove(TEST_INDEX_PATH)except FileNotFoundError:print("No test index found, creating")- with TinyIndexer(TEST_INDEX_PATH, NUM_PAGES, PAGE_SIZE) as indexer:+ with TinyIndexer(TEST_INDEX_PATH, TEST_NUM_PAGES, TEST_PAGE_SIZE) as indexer:titles_and_urls = get_wiki_titles_and_urls()titles_and_urls_slice = islice(titles_and_urls, NUM_DOCUMENTS)