Skip to content

Conversation

GitBib
Copy link
Owner

@GitBib GitBib commented Oct 4, 2025

This commit implements several performance optimizations to significantly reduce the number of mkvmerge subprocess calls when loading MKV files.

Key changes:

  • Cache verify_mkvmerge() results using @cache decorator to avoid repeated mkvmerge -V calls across multiple file loads
  • Remove redundant verify_supported() call from MKVFile.init before get_file_info(), checking container["supported"] from JSON response instead
  • Skip verify_supported() in MKVTrack.file_path setter when existing_info is already provided (tracks from existing MKV don't need revalidation)
  • Add pyinstrument profiling support for tests with per-test HTML reports

Performance improvement:

  • Before: ~10 seconds to load 10 files
  • After: ~0.4 seconds to load 10 files
  • Speedup: ~25x faster

Addresses performance issues raised in #16 by eliminating duplicate mkvmerge invocations while maintaining file validation integrity.

…merge calls

This commit implements several performance optimizations to significantly
reduce the number of mkvmerge subprocess calls when loading MKV files.

Key changes:
- Cache verify_mkvmerge() results using @cache decorator to avoid repeated
  mkvmerge -V calls across multiple file loads
- Remove redundant verify_supported() call from MKVFile.__init__ before
  get_file_info(), checking container["supported"] from JSON response instead
- Skip verify_supported() in MKVTrack.file_path setter when existing_info
  is already provided (tracks from existing MKV don't need revalidation)
- Add pyinstrument profiling support for tests with per-test HTML reports

Performance improvement:
- Before: ~10 seconds to load 10 files
- After: ~0.4 seconds to load 10 files
- Speedup: ~25x faster

Addresses performance issues raised in #16 by eliminating duplicate mkvmerge
invocations while maintaining file validation integrity.
Copy link

codecov bot commented Oct 4, 2025

Codecov Report

❌ Patch coverage is 94.73684% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 67.01%. Comparing base (502bd1a) to head (7aa35af).
⚠️ Report is 13 commits behind head on master.

Files with missing lines Patch % Lines
pymkv/Verifications.py 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #81      +/-   ##
==========================================
+ Coverage   66.87%   67.01%   +0.13%     
==========================================
  Files          10       10              
  Lines         951      958       +7     
==========================================
+ Hits          636      642       +6     
- Misses        315      316       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Use regex pattern to support both Unix (/) and Windows (\) path
separators in test_file_not_support and test_track_not_support.
@GitBib GitBib merged commit d223bef into master Oct 5, 2025
19 checks passed
@GitBib GitBib deleted the perf/optimize-mkv-loading branch October 5, 2025 09:39
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