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

Performance Optimization of Compression: Low hanging fruits #3

Open
2 of 3 tasks
torfmaster opened this issue Jan 6, 2022 · 4 comments
Open
2 of 3 tasks

Performance Optimization of Compression: Low hanging fruits #3

torfmaster opened this issue Jan 6, 2022 · 4 comments
Labels

Comments

@torfmaster
Copy link
Owner

torfmaster commented Jan 6, 2022

Although asymptotically BWT is the most expensive operation during compression, only 40% is spent during BWT. There are some hot spots which are potentially easy to fix:

  • ribzip2::lib::block::zle::zle_transform spends 15% in HashSet and HashMap operations. Both can be replaced by operations which finish in constant time. Also vector operations might be improved up by pre-allocating sufficient memory.
  • ribzip2::lib::block::block_data::generate_block_data spends 15% of the time on the final encoding step, most of the time during inefficient (linear) access to the coding table.
  • run ribzip2::lib::block::huffman::package_merge::package_merge only if code length exceeds 20 bits - saves 1,5% of runtime
@torfmaster torfmaster added help wanted Extra attention is needed good first issue Good for newcomers difficulty medium and removed help wanted Extra attention is needed labels Jan 6, 2022
@torfmaster
Copy link
Owner Author

Having implemented the first two goals, the impact of the third now is 2.65%.

@torfmaster
Copy link
Owner Author

Updated difficulty: the last point is significantly easier.

@NiklasEi
Copy link

I do not understand the last point. Looking at the usage of ribzip2::lib::block::huffman::package_merge::package_merge, it only gets called with length = 17

let code_lengths = compute_lis(&weights, 17);

@torfmaster
Copy link
Owner Author

@NiklasEi the re-computation of the huffman tables is only necessary if the maximum length actually exceeds 17 bits. So otherwise this step can be skipped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants