fix: resolve ruff lint errors in benchmark suite
Remove unused imports (shutil, string, datetime, os, yaml, time, SCALE_CONFIGS) and unused variable assignments in timing-only calls.
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -10,7 +10,6 @@ Planted "needle" drawers enable recall measurement without an LLM judge.
|
||||
import hashlib
|
||||
import os
|
||||
import random
|
||||
import string
|
||||
from datetime import datetime, timedelta
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ conftest.py pytest_terminal_summary hook writes the collected results.
|
||||
import json
|
||||
import os
|
||||
import tempfile
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
RESULTS_FILE = os.path.join(tempfile.gettempdir(), "mempalace_bench_results.json")
|
||||
|
||||
@@ -8,12 +8,10 @@ Measures mining performance at scale:
|
||||
- Re-ingest skip overhead (finding #11: file_already_mined check)
|
||||
"""
|
||||
|
||||
import os
|
||||
import time
|
||||
|
||||
import chromadb
|
||||
import pytest
|
||||
import yaml
|
||||
|
||||
from tests.benchmarks.data_generator import PalaceDataGenerator
|
||||
from tests.benchmarks.report import record_metric
|
||||
|
||||
@@ -56,7 +56,6 @@ class TestQueryEntityLatency:
|
||||
from mempalace.knowledge_graph import KnowledgeGraph
|
||||
|
||||
kg = KnowledgeGraph(db_path=str(tmp_path / "kg.sqlite3"))
|
||||
gen = PalaceDataGenerator(seed=42)
|
||||
|
||||
# Create a hub entity connected to many others
|
||||
kg.add_entity("Hub", "person")
|
||||
@@ -72,7 +71,7 @@ class TestQueryEntityLatency:
|
||||
latencies = []
|
||||
for _ in range(20):
|
||||
start = time.perf_counter()
|
||||
result = kg.query_entity("Hub")
|
||||
kg.query_entity("Hub")
|
||||
elapsed_ms = (time.perf_counter() - start) * 1000
|
||||
latencies.append(elapsed_ms)
|
||||
|
||||
@@ -106,7 +105,7 @@ class TestTimelinePerformance:
|
||||
latencies = []
|
||||
for _ in range(10):
|
||||
start = time.perf_counter()
|
||||
result = kg.timeline()
|
||||
kg.timeline()
|
||||
elapsed_ms = (time.perf_counter() - start) * 1000
|
||||
latencies.append(elapsed_ms)
|
||||
|
||||
@@ -143,8 +142,6 @@ class TestTemporalQueryAccuracy:
|
||||
|
||||
# Query Alice as of March 2024 — should find ProjectA
|
||||
result_march = kg.query_entity("Alice", as_of="2024-03-15")
|
||||
project_names = [r.get("object") or r.get("name", "") for r in result_march] if isinstance(result_march, list) else []
|
||||
|
||||
# Query Alice as of September 2024 — should find ProjectB
|
||||
result_sept = kg.query_entity("Alice", as_of="2024-09-15")
|
||||
|
||||
@@ -161,7 +158,6 @@ class TestSQLiteConcurrentAccess:
|
||||
from mempalace.knowledge_graph import KnowledgeGraph
|
||||
|
||||
kg = KnowledgeGraph(db_path=str(tmp_path / "kg.sqlite3"))
|
||||
gen = PalaceDataGenerator(seed=42)
|
||||
|
||||
# Pre-create entities
|
||||
for i in range(100):
|
||||
@@ -276,7 +272,7 @@ class TestKGStats:
|
||||
latencies = []
|
||||
for _ in range(10):
|
||||
start = time.perf_counter()
|
||||
result = kg.stats()
|
||||
kg.stats()
|
||||
elapsed_ms = (time.perf_counter() - start) * 1000
|
||||
latencies.append(elapsed_ms)
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ Tests MemoryStack.wake_up(), Layer1.generate(), and Layer2/L3
|
||||
at scale. Layer1 has the same unbounded col.get() as tool_status.
|
||||
"""
|
||||
|
||||
import os
|
||||
import time
|
||||
|
||||
import pytest
|
||||
@@ -168,7 +167,7 @@ class TestLayer2Retrieval:
|
||||
latencies = []
|
||||
for _ in range(10):
|
||||
start = time.perf_counter()
|
||||
text = layer.retrieve(wing=wing, n_results=10)
|
||||
layer.retrieve(wing=wing, n_results=10)
|
||||
elapsed_ms = (time.perf_counter() - start) * 1000
|
||||
latencies.append(elapsed_ms)
|
||||
|
||||
@@ -198,7 +197,7 @@ class TestLayer3Search:
|
||||
latencies = []
|
||||
for q in queries:
|
||||
start = time.perf_counter()
|
||||
text = stack.search(q, n_results=5)
|
||||
stack.search(q, n_results=5)
|
||||
elapsed_ms = (time.perf_counter() - start) * 1000
|
||||
latencies.append(elapsed_ms)
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import time
|
||||
import chromadb
|
||||
import pytest
|
||||
|
||||
from tests.benchmarks.data_generator import PalaceDataGenerator, SCALE_CONFIGS
|
||||
from tests.benchmarks.data_generator import PalaceDataGenerator
|
||||
from tests.benchmarks.report import record_metric
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ Targets the highest-risk code paths:
|
||||
- Layer1.generate() (fetches all drawers)
|
||||
"""
|
||||
|
||||
import time
|
||||
import tracemalloc
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -8,7 +8,6 @@ wing+room to find the actual embedding model limit.
|
||||
|
||||
import hashlib
|
||||
import os
|
||||
import time
|
||||
from datetime import datetime
|
||||
|
||||
import chromadb
|
||||
|
||||
@@ -216,7 +216,7 @@ class TestSearchNResultsScaling:
|
||||
latencies = []
|
||||
for _ in range(5):
|
||||
start = time.perf_counter()
|
||||
result = search_memories(
|
||||
search_memories(
|
||||
"authentication middleware", palace_path=palace_path, n_results=n_results
|
||||
)
|
||||
latencies.append((time.perf_counter() - start) * 1000)
|
||||
|
||||
Reference in New Issue
Block a user