[PR #120] [CLOSED] feat: reuse keystream in decryptor if possible #223

Closed
opened 2026-02-28 14:26:18 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/devgianlu/go-librespot/pull/120
Author: @aykevl
Created: 10/7/2024
Status: Closed

Base: masterHead: perf-decryptor


📝 Commits (1)

  • 9922f73 feat: reuse keystream in decryptor if possible

📊 Changes

1 file changed (+26 additions, -13 deletions)

View changed files

📝 audio/decryptor.go (+26 -13)

📄 Description

This avoids some unnecessary restarting of the stream and therefore makes the decryptor much, much more efficient when reading sequential data.

I did some profiling with some very hacky code, and for decoding a single song (*audio.Decryptor).ReadAt took 2.47s total of the decoding time. After this change it took 0.03s - all of which was actually from (*audio.HttpChunkedReader).ReadAt and not the decrypting.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/devgianlu/go-librespot/pull/120 **Author:** [@aykevl](https://github.com/aykevl) **Created:** 10/7/2024 **Status:** ❌ Closed **Base:** `master` ← **Head:** `perf-decryptor` --- ### 📝 Commits (1) - [`9922f73`](https://github.com/devgianlu/go-librespot/commit/9922f73ed080d2efd2a6bea81ee4d4006c8a3b52) feat: reuse keystream in decryptor if possible ### 📊 Changes **1 file changed** (+26 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `audio/decryptor.go` (+26 -13) </details> ### 📄 Description This avoids some unnecessary restarting of the stream and therefore makes the decryptor much, much more efficient when reading sequential data. I did some profiling with some very hacky code, and for decoding a single song `(*audio.Decryptor).ReadAt` took 2.47s total of the decoding time. After this change it took 0.03s - all of which was actually from `(*audio.HttpChunkedReader).ReadAt` and not the decrypting. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 14:26:18 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/go-librespot#223
No description provided.