Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimized apng detection algorithm #2

Merged
merged 3 commits into from
Aug 9, 2024

Conversation

madtisa
Copy link

@madtisa madtisa commented Aug 9, 2024

  • Reduced memory allocations by avoiding decoding buffer
  • Increased algorithm performance by:
    • replacing regex matching with index search
    • going through buffer one time instead of two

madtisa and others added 3 commits August 9, 2024 16:52
- Reduce memory allocations by avoiding decoding buffer
- Increase algorithm performance by:
 - replacing regex matching with index search
 - going through buffer one time instead of two
Added additional tests to check for false-positives (missing or preceding IDAT chunk).
* Fix: Catch false-positive where `acTL` is present, but no following `IDAT`
* Perf: Refactored and simplified code
@vHeemstra
Copy link
Owner

Thank you for the PR! Your algorithm is indeed more performant.

I improved on it a bit more and will merge it in version 1.1.1.

@vHeemstra vHeemstra merged commit b0b9a66 into vHeemstra:main Aug 9, 2024
3 checks passed
src/index.ts Show resolved Hide resolved
@madtisa madtisa deleted the f/optimize-algorithm branch August 12, 2024 07:00
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.

2 participants