"""Benchmark tests for NoteFlow hot paths. These benchmarks measure the performance of frequently-called code paths to establish baselines and detect regressions. Run with: pytest tests/benchmarks/ --benchmark-enable Compare: pytest tests/benchmarks/ --benchmark-compare Save baseline: pytest tests/benchmarks/ --benchmark-save=baseline Note: These tests are marked as slow and excluded from CI unit test runs. Run explicitly with: pytest tests/benchmarks/ -m slow """ from __future__ import annotations from typing import TYPE_CHECKING from uuid import UUID import numpy as np import pytest from numpy.typing import NDArray from pytest_benchmark.fixture import BenchmarkFixture from noteflow.application.services.voice_profile.service import ( EMBEDDING_DIM, cosine_similarity, merge_embeddings, ) from noteflow.config.constants import DEFAULT_SAMPLE_RATE from noteflow.domain.entities.segment import Segment, WordTiming from noteflow.domain.value_objects import AudioSource, MeetingId, SpeakerRole from noteflow.infrastructure.asr.segmenter import AudioSegment, Segmenter, SegmenterConfig from noteflow.infrastructure.asr.streaming_vad import EnergyVad, StreamingVad from noteflow.infrastructure.audio.levels import RmsLevelProvider, compute_rms from noteflow.infrastructure.logging.log_buffer import LogEntry from noteflow.infrastructure.metrics.collector import PerformanceMetrics # Mark all tests in this module as slow (excluded from CI unit tests) pytestmark = pytest.mark.slow if TYPE_CHECKING: from noteflow.grpc.mixins.converters import SegmentBuildParams from noteflow.infrastructure.asr.dto import AsrResult