Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.

faster pyrogram lre encode implementation#938

Merged
delivrance merged 3 commits into
pyrogram:masterfrom
andrew-ld:faster_rle_encode
Mar 28, 2022
Merged

faster pyrogram lre encode implementation#938
delivrance merged 3 commits into
pyrogram:masterfrom
andrew-ld:faster_rle_encode

Conversation

@andrew-ld
Copy link
Copy Markdown
Contributor

in accordance with my tests (https://gist.github.com/andrew-ld/72f8ac8c41330a47c99a9f79958625eb), using a list and only at the end converting it in bytes is more efficient because bytes is an immutable instance.

testing sample 1
old 7.225026909000007
new 3.8671077140002126

testing sample 2
old 6.551758901000085
new 3.8057729349998226

testing sample 3
old 11.08116247199996
new 5.3508748690001084

testing sample 4
old 10.761553993000234
new 5.434736396000062

@delivrance
Copy link
Copy Markdown
Member

The same can be applied to rle_decode, maybe you forgot to update that as well?

@andrew-ld
Copy link
Copy Markdown
Contributor Author

https://gist.github.com/andrew-ld/66f91ea99b358babddf6d48892c7569f


testing sample (encode) 1
old 6.480077871000049
new 3.533378029000005

testing sample (decode) 1
old 5.345238713999834
new 3.016241528999899

testing sample (encode) 2
old 6.161729186000002
new 3.471152747000133

testing sample (decode) 2
old 4.89709794800001
new 2.9770840950000093

testing sample (encode) 3
old 10.826596197000072
new 5.394032051000067

testing sample (decode) 3
old 9.560668955999972
new 5.331679084999905

testing sample (encode) 4
old 11.025338080999973
new 5.369964738999897

testing sample (decode) 4
old 9.320508534999817
new 4.887565167000048

@andrew-ld
Copy link
Copy Markdown
Contributor Author

@delivrance ping

@delivrance delivrance merged commit 06ee482 into pyrogram:master Mar 28, 2022
@delivrance
Copy link
Copy Markdown
Member

Merged, thanks.

AsmSafone pushed a commit to AsmSafone/pyrogram that referenced this pull request Apr 8, 2022
* faster pyrogram lre encode implementation

* Update file_id.py

* optimized rle decode

Co-authored-by: andrew (from workstation) <andrew-ld@protonmail.com>
Co-authored-by: Dan <14043624+delivrance@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants