Uh oh!
There was an error while loading. Please reload this page.
Optimize get-clip SRT lookup with LRU cache and time-based indexing - #40
Draft
andmoredev with Copilot wants to merge 6 commits into
Draft
Optimize get-clip SRT lookup with LRU cache and time-based indexing#40andmoredev with Copilot wants to merge 6 commits into
andmoredev with Copilot wants to merge 6 commits into
Conversation
Merged
Co-authored-by: andmoredev <33256364+andmoredev@users.noreply.github.com>
Co-authored-by: andmoredev <33256364+andmoredev@users.noreply.github.com>
Co-authored-by: andmoredev <33256364+andmoredev@users.noreply.github.com>
Co-authored-by: andmoredev <33256364+andmoredev@users.noreply.github.com>
Co-authored-by: andmoredev <33256364+andmoredev@users.noreply.github.com>
CopilotAI
changed the title
[WIP] Apply changes based on feedback from PR #37 reviewOptimize get-clip SRT lookup with LRU cache and time-based indexingFeb 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The get-clip handler was loading SRT files from S3 on every request and filtering all entries for each segment, resulting in O(segments × entries) complexity. For clips with multiple segments and large SRT files (hundreds of entries), this created unnecessary I/O and computational overhead.
Changes:
LRU cache with 50-entry limit: Caches parsed and indexed SRT data to prevent repeated S3 downloads and re-parsing. Evicts oldest entries when full to prevent unbounded memory growth in long-running Lambda containers.
Time-based bucket index: Groups SRT entries into 10-second buckets. Lookup now queries only relevant buckets instead of filtering all entries, reducing complexity to O(segments × entries_per_bucket).
Reuses existing infrastructure: Leverages the
loadTranscriptutility which already provides S3-level caching.Module constants
MAX_CACHE_SIZEandBUCKET_SIZEallow easy tuning based on operational metrics.💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.