Skip to content

Implement chunked IndexedDB storage for memory optimization#26

Closed
Amanmahe wants to merge 551 commits into
akadeepesh:mainfrom
Amanmahe:main
Closed

Implement chunked IndexedDB storage for memory optimization#26
Amanmahe wants to merge 551 commits into
akadeepesh:mainfrom
Amanmahe:main

Conversation

@Amanmahe
Copy link
Copy Markdown

Problem

Current IndexedDB implementation rewrites entire file on each append, causing:

  • O(n) memory usage growth
  • 500ms+ per write operation
  • Cannot handle >1 hour recordings at 500Hz

Solution

Implement chunked storage architecture:

  • Split data into 1000-array chunks
  • Append only to last chunk
  • Separate metadata tracking
  • Memory usage: O(1) vs O(n)

Changes

  • Added FileMetadata and DataChunks stores
  • Composite key: [filename, chunkIndex]
  • Updated writeToIndexedDB for chunked append
  • Maintained all existing APIs
  • DB version: 2 → 3 with auto-migration

Performance Impact

Duration Before After
1 min 30MB 2KB
1 hour 1.8GB 2KB

@lorforlinux , Please review and merge it.

Ritika Mishra and others added 27 commits November 18, 2025 11:43
Resolve build failures, upgrade Next.js and dependencies
Updated version of next to ^16.0.7 and react 19.0.1.
- Replace single-file storage with chunk-based architecture
- Add FileMetadata store for tracking file information
- Implement DataChunks store with composite key [filename, chunkIndex]
- Update write operations to append only to relevant chunks
- Maintain backward compatibility with existing API
- Improve performance for 500Hz continuous data streams
- Reduce memory usage from O(n) to O(1) for append operations

BREAKING CHANGE: Database version upgraded to 3. Existing data will be migrated automatically.
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 11, 2026

@Amanmahe is attempting to deploy a commit to the DeCoder's projects Team on Vercel.

A member of the Team first needs to authorize it.

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