Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid allocating all RawBlock4X4Rgba32 blocks to reduce memory overhead #33

Open
ptasev opened this issue Feb 3, 2021 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@ptasev
Copy link
Contributor

ptasev commented Feb 3, 2021

It seems the code allocates all blocks necessary during decoding, but these blocks are only used temporarily. It would be ideal if instead of allocating separate blocks, the decoded data is written directly to the output instead of these temporary blocks.

An example could be that the blocks to process are divided up so that they are separated evenly on each thread. Each thread allocates a single RawBlock4X4Rgba32 and decodes each block serially using that temporary block. Then the contents of the raw block are written directly to the output image at the proper location.

Not sure if this is worth it, but interested to hear your thoughts.

@Nominom
Copy link
Owner

Nominom commented Feb 3, 2021

Thanks for suggesting this.

There's a lot that could be improved in terms of using system memory and general performance and this would probably be one of the easier ones to fix. Although, I think there's always some sort of a tradeoff between writing performant code and readable code.

I'm not going to add this change in 2.0 yet, but if someone wants to create a pr with a fix that doesn't hurt readability too much, that would be greatly appreciated.

I'll probably also look into more ways to improve performance and memory usage without sacrificing readability some time after 2.0 release.

@Nominom Nominom added the enhancement New feature or request label Feb 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants