Parse MKV from a memory-mapped buffer instead of per-byte reads

Open
#89 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
macos, swift

Research direction

Start by locating EBMLParser.readVINT and tracing how it reads block headers and advances through the file. Compare the current FileHandle reads and seeks with the proposed memory-mapped Data approach, including bounds checks and I/O error handling. Done means parsing uses a mapped buffer with a checked cursor and avoids per-byte reads and seeks.

Written by the indexing model from the issue text.

Description

enhancement

EBMLParser.readVINT does a FileHandle.readData(ofLength: 1) per byte, offsetInFile is an lseek, and the parser walks every video/audio block header. That is millions of syscalls per film and is slow on external/network volumes. The legacy FileHandle APIs also raise Objective-C exceptions (crash) on I/O errors.

Proposal: memory-map the file (Data(contentsOf:options: .alwaysMapped)) and parse from a pointer/cursor with bounds checks.

Dominant language
Swift
Stars
42
Forks
9
Avg merge
9h 30m
Merged PRs (30d)
4

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ecdye/macSubtitleOCR

All issues in ecdye/macSubtitleOCR

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.