shazamio / ShazamIO

🎵 Is a free asynchronous library from reverse engineered Shazam API written in Python 3.8+ with asyncio and aiohttp.
MIT License
490 stars 69 forks source link

Speedup peak spreading #32

Closed Dronablo closed 2 years ago

Dronablo commented 2 years ago

I tried recognize_song on different inputs and py-spy shows that most of the time was spent not on waiting response from Shazam itself, but on waiting for do_peak_spreading(). My timings was like '1.5 seconds in preak_spreading for 3 seconds of input or 6 seconds in preak_spreading for 10 seconds of input`.

So, here is a numpy implementation:

lgtm-com[bot] commented 2 years ago

This pull request introduces 1 alert and fixes 1 when merging ff1080f592b53115a2456b078a6b0e08bce78f68 into 3f3c7b9da2e487f4fc78335b18d75a642f973621 - view on LGTM.com

new alerts:

fixed alerts:

dotX12 commented 2 years ago

@Dronablo, Please post tests before and after implementing the numpy library.

Dronablo commented 2 years ago

@Dronablo, Please post tests before and after implementing the numpy library.

Done

lgtm-com[bot] commented 2 years ago

This pull request introduces 1 alert when merging 4f9e4935b364857ced5e8a5b56ca144135080415 into 3f3c7b9da2e487f4fc78335b18d75a642f973621 - view on LGTM.com

new alerts:

lgtm-com[bot] commented 2 years ago

This pull request introduces 1 alert when merging a9578035f6ffd5980f02fc0f8e660a6362f5bc7b into 3f3c7b9da2e487f4fc78335b18d75a642f973621 - view on LGTM.com

new alerts:

dotX12 commented 2 years ago

test:

async def tasks():
    a = [main(), main(), main(), main(), main(), main(), main()]
    res = await asyncio.gather(*a)
    return res

before: 6.474631299999601 after: 3.4023000999986834

realy good

dotX12 commented 2 years ago

@Dronablo, Thx!

dotX12 commented 2 years ago

https://github.com/dotX12/ShazamIO/releases/tag/0.3.0.0 Released!