[PR #121] [MERGED] feat: improve efficiency of the decryptor #222

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/121
Author: @aykevl
Created: 10/7/2024
Status: Merged
Merged: 10/12/2024
Merged by: @devgianlu

Base: masterHead: perf-decryptor-2


📝 Commits (1)

  • e7dd509 feat: improve efficiency of the decryptor

📊 Changes

1 file changed (+10 additions, -10 deletions)

View changed files

📝 audio/decryptor.go (+10 -10)

📄 Description

The decryptor was using up a lot of time. For a ~10min song it took about twice the time that it took to run the Vorbis decoder and this time would only go up considering the exponential nature of the loop.

But actually, all it did was count up a number. This can be done using a simple addition instead of a complicated loop. Hence this patch changes the loop to a simple addition.

It is 32-bits at the moment, which means it would overflow with a stream that's 64GB 48GB big. This is entirely fixable if needed, but 48GB seems like an unlikely large stream. Updated to be 64 bits to make me feel better, this is extremely unlikely to ever overflow.

This replaces #120.


🔄 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/121 **Author:** [@aykevl](https://github.com/aykevl) **Created:** 10/7/2024 **Status:** ✅ Merged **Merged:** 10/12/2024 **Merged by:** [@devgianlu](https://github.com/devgianlu) **Base:** `master` ← **Head:** `perf-decryptor-2` --- ### 📝 Commits (1) - [`e7dd509`](https://github.com/devgianlu/go-librespot/commit/e7dd509de60aae27df2bd41049149df50ae38727) feat: improve efficiency of the decryptor ### 📊 Changes **1 file changed** (+10 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `audio/decryptor.go` (+10 -10) </details> ### 📄 Description The decryptor was using up a lot of time. For a ~10min song it took about twice the time that it took to run the Vorbis decoder and this time would only go up considering the exponential nature of the loop. But actually, all it did was count up a number. This can be done using a simple addition instead of a complicated loop. Hence this patch changes the loop to a simple addition. ~It is 32-bits at the moment, which means it would overflow with a stream that's ~64GB~ 48GB big. This is entirely fixable if needed, but 48GB seems like an unlikely large stream.~ Updated to be 64 bits to make me feel better, this is extremely unlikely to ever overflow. This replaces #120. --- <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#222
No description provided.