Skip to content

Conversation

Johannesd3
Copy link
Contributor

This PR picks up the effort made in #459 to refactor SpotifyId. Since @alcore seems not to be interested anymore, I rebased it and applied some minor changes.

As stated in the original PR, the performance increases significantly, but the code is sometimes more complex. It could be discussed whether the uses of unsafe or some manual optimizations are worth the speedup if there's another simpler solution that is not too slow.

Is there anything else that has to be done before this PR could get merged?

alcore and others added 2 commits January 29, 2021 11:33
- perf:
  * base62 encoding is an order of magnitude faster (~20x);
  * base16/62 enc/dec and from_uri are several times faster (~2-20x);
  * Let FileId::to_base16() reuse the hex encoder (~20x);

- changes:
  * Add to_uri() method;
  * Make from_uri() error handling consistent;
  * Move audio type from string matching to a SpotifyAudioType factory (private);
  * Implent From/Into<&str> for SpotifyAudioType;
  * Add representation sizes as associated constants (private);

- cs/docs:
  * Add rudimentary docs for most public funcs;
  * Add trivial test cases for the codecs;
Moved conversion of SpotifyAudioType from and to &str directly to traits
Used a simpler and more idiomatic syntax in some places.
@sashahilton00 sashahilton00 mentioned this pull request Jan 30, 2021
@sashahilton00 sashahilton00 merged commit 89eaa39 into librespot-org:dev Jan 30, 2021
@Johannesd3
Copy link
Contributor Author

Are the tests already included in CI?

@Johannesd3 Johannesd3 deleted the refactor-spotify-id branch January 30, 2021 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants