use std::hint::black_box; use criterion::{criterion_group, criterion_main, Criterion}; use vapora_tracking::parsers::{ClaudeTodoParser, MarkdownParser}; fn markdown_parse_changes_bench(c: &mut Criterion) { let content = "---\nproject: vapora\nlast_sync: 2025-11-10T14:30:00Z\n---\n\n## \ 2025-11-10T14:30:00Z - Implemented WebSocket sync\n**Impact**: backend | \ **Breaking**: no | **Files**: 5\nNon-blocking async synchronization using \ tokio channels.\n\n## 2025-11-09T10:15:00Z - Fixed database \ indices\n**Impact**: performance | **Breaking**: no | **Files**: 2\nOptimized \ query performance for tracking entries.\n\n## 2025-11-08T16:45:00Z - Added \ error context\n**Impact**: infrastructure | **Breaking**: no | **Files**: \ 3\nImproved error messages with structured logging.\n"; c.bench_function("markdown_parse_changes_small", |b| { b.iter(|| MarkdownParser::parse_changes(black_box(content), black_box("/test"))) }); } fn markdown_parse_todos_bench(c: &mut Criterion) { let content = "---\nproject: vapora\nlast_sync: 2025-11-10T14:30:00Z\n---\n\n## [ ] Implement \ webhook system\n**Priority**: H | **Estimate**: L | **Tags**: #feature \ #api\n**Created**: 2025-11-10T14:30:00Z | **Due**: 2025-11-15\nImplement \ bidirectional webhook system for real-time events.\n\n## [>] Refactor database \ layer\n**Priority**: M | **Estimate**: M | **Tags**: #refactor \ #database\n**Created**: 2025-11-08T10:00:00Z | **Due**: 2025-11-20\nImprove \ database abstraction and reduce code duplication.\n\n## [x] Setup CI/CD \ pipeline\n**Priority**: H | **Estimate**: S | **Tags**: \ #infrastructure\n**Created**: 2025-11-05T08:00:00Z\nGitHub Actions workflow \ for automated testing.\n"; c.bench_function("markdown_parse_todos_small", |b| { b.iter(|| MarkdownParser::parse_todos(black_box(content), black_box("/test"))) }); } fn claude_todo_parser_bench(c: &mut Criterion) { let content = r#"[ { "content": "Implement feature X", "status": "pending" }, { "content": "Fix bug in parser", "status": "in_progress" }, { "content": "Update documentation", "status": "completed" } ]"#; c.bench_function("claude_todo_parse_small", |b| { b.iter(|| ClaudeTodoParser::parse(black_box(content), black_box("/test"))) }); } criterion_group!( benches, markdown_parse_changes_bench, markdown_parse_todos_bench, claude_todo_parser_bench ); criterion_main!(benches);