Skip to content

improve safe frame compression performance 7-15%#74

Merged
PSeitz merged 1 commit intomainfrom
the_real_main
Feb 3, 2023
Merged

improve safe frame compression performance 7-15%#74
PSeitz merged 1 commit intomainfrom
the_real_main

Conversation

@PSeitz
Copy link
Owner

@PSeitz PSeitz commented Feb 2, 2023

The frame encoding uses a fixed size hashtable.
By creating a special hashtable with a Box<[u32; 4096]> size,
in combination with the bit shift of 4, which is also moved into a constant,
the compiler can remove the bounds checks.
For that to happen, the compiler also needs to recognize the >> 48 right
shift from the hash algorithm (u64 >> 52 <= 4096), which is the case. Yey

The frame encoding uses a fixed size hashtable.
By creating a special hashtable with a Box<[u32; 4096]> size,
in combination with the bit shift of 4, which is also moved into a constant,
the compiler can remove the bounds checks.
For that to happen, the compiler also needs to recognize the `>> 48` right
shift from the hash algorithm (u64 >> 52 <= 4096), which is the case. Yey

It also means we can use less `unsafe` for the unsafe version
@PSeitz PSeitz merged commit f249b55 into main Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant