Skip to content

[FEAT]: Performance Tests#6

Merged
SeedyROM merged 1 commit intomainfrom
feat/performance-tests
Sep 3, 2025
Merged

[FEAT]: Performance Tests#6
SeedyROM merged 1 commit intomainfrom
feat/performance-tests

Conversation

@SeedyROM
Copy link
Owner

@SeedyROM SeedyROM commented Sep 2, 2025

Changes:

  • Refactor kiko-backend to be a library and have an executable.
  • Write some criterion benchmarks for the most critical systems.

@SeedyROM SeedyROM requested a review from Copilot September 2, 2025 04:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive performance testing infrastructure using the Criterion benchmarking library. The changes include refactoring the kiko-backend crate to be a library with an executable, and implementing benchmarks for critical systems including ID generation, session management, and PubSub messaging.

Key changes:

  • Refactored kiko-backend to expose public library API while maintaining executable functionality
  • Added Criterion benchmark suites for ID generation, session service operations, and PubSub messaging
  • Updated documentation with performance testing guidance and instructions

Reviewed Changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
crates/kiko/benches/id_generation.rs Comprehensive benchmarks for ID generation performance, uniqueness validation, and serialization
crates/kiko-backend/benches/session_service.rs Performance tests for session CRUD operations, participant management, and concurrent access
crates/kiko-backend/benches/pubsub.rs Benchmarks for PubSub messaging throughput, concurrent operations, and memory cleanup
crates/kiko-backend/src/lib.rs New library entry point exposing public API
crates/kiko-backend/src/main.rs Refactored executable to use library modules
crates/kiko-backend/src/services/sessions.rs Added Clone derive for benchmarking compatibility
crates/kiko/Cargo.toml Added Criterion dependencies and benchmark configuration
crates/kiko-backend/Cargo.toml Added dev dependencies for async benchmarking
CLAUDE.md Updated documentation with performance testing commands and guidance

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

let mut ids = HashSet::new();
for _ in 0..count {
let id = SessionId::new();
ids.insert(id.as_str().to_string());
Copy link

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting to string via id.as_str().to_string() is inefficient for uniqueness testing. Consider inserting the ID directly into HashSet<SessionId> since IDs likely implement Hash and Eq, which would avoid unnecessary string allocations.

Copilot uses AI. Check for mistakes.
let mut ids = HashSet::new();
for _ in 0..count {
let id = ParticipantId::new();
ids.insert(id.as_str().to_string());
Copy link

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting to string via id.as_str().to_string() is inefficient for uniqueness testing. Consider inserting the ID directly into HashSet<ParticipantId> since IDs likely implement Hash and Eq, which would avoid unnecessary string allocations.

Copilot uses AI. Check for mistakes.
c.bench_function("id_from_string", |b| {
b.iter(|| {
for s in &sample_strings {
black_box(SessionId::from_string(s.clone()));
Copy link

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cloning the string for each iteration is inefficient in a benchmark. Consider using SessionId::from_string(s) or SessionId::from(s.as_str()) to avoid unnecessary allocations during performance measurement.

Suggested change
black_box(SessionId::from_string(s.clone()));
black_box(SessionId::from_string(s));

Copilot uses AI. Check for mistakes.
@SeedyROM SeedyROM merged commit 0b4d6bd into main Sep 3, 2025
1 check passed
@SeedyROM SeedyROM deleted the feat/performance-tests branch September 3, 2025 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments