Skip to content

Conversation

cryo-zd
Copy link
Contributor

@cryo-zd cryo-zd commented Oct 5, 2025

What type of PR is this?

perf: optimize FindSimilar by tracking best match

What this PR does / why we need it:
This PR optimized the performance of func (c *InMemoryCache) FindSimilar by dynamically tracking the best-matched cache entry in the main loop so that we don't need to store all candidates in a temporary slice and then sort the entire slice. This reduce the time complexity of FindSimilar from $O(N + NlogN)$ to $O(N)$ and reduce memory allocation.

Which issue(s) this PR fixes:

Fixes #

Release Notes: Yes/No

Copy link

github-actions bot commented Oct 5, 2025

👥 vLLM Semantic Team Notification

The following members have been identified for the changed files in this PR and have been automatically assigned:

📁 src

Owners: @rootfs, @Xunzhuo, @wangchen615
Files changed:

  • src/semantic-router/pkg/cache/inmemory_cache.go

vLLM

🎉 Thanks for your contributions!

This comment was automatically generated based on the OWNER files in the repository.

Copy link

netlify bot commented Oct 5, 2025

Deploy Preview for vllm-semantic-router ready!

Name Link
🔨 Latest commit f7b9b2b
🔍 Latest deploy log https://app.netlify.com/projects/vllm-semantic-router/deploys/68e2481a25164f000922a5b1
😎 Deploy Preview https://deploy-preview-347--vllm-semantic-router.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@rootfs rootfs merged commit 35a95f8 into vllm-project:main Oct 5, 2025
9 checks passed
@cryo-zd cryo-zd deleted the perf/findSimilar branch October 5, 2025 16:43
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.

4 participants