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

update to huffman v2 - removes tree initialization nearly completely #24

Merged
merged 2 commits into from
Sep 18, 2024

Conversation

jxsl13
Copy link
Contributor

@jxsl13 jxsl13 commented Sep 18, 2024

No description provided.

@jxsl13
Copy link
Contributor Author

jxsl13 commented Sep 18, 2024

old (Unpack):
Bildschirmfoto 2024-09-18 um 06 05 50

new - not visible at all:
Bildschirmfoto 2024-09-18 um 06 09 51

It was a quick benchmark, nothing scientific or sophisticated.

Sampling times differ by a factor of 5x. 10 vs 2 secs

@@ -336,8 +336,7 @@ func (packet *Packet) Unpack(data []byte) (err error) {
if packet.Header.Flags.Compression {
// TODO: try avoiding repeated initialization of the huffman tree structure
// move this into the Packet struct or even further up
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment can be removed now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@ChillerDragon
Copy link
Member

yay faster is really cool!

But now we are forced to rebuild the tree for every packet and can not cache it?

@jxsl13
Copy link
Contributor Author

jxsl13 commented Sep 18, 2024

it was previously rebuild every time. Now it's build once upon application startup as a global dictionary variable in the huffman v2 package. And reused for lookups.

@ChillerDragon
Copy link
Member

Okay nice. I think we had that discussion in the huffman repo already 🙈

@ChillerDragon
Copy link
Member

Nice thanks

@ChillerDragon ChillerDragon merged commit 6b91e61 into teeworlds-go:master Sep 18, 2024
5 checks passed
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.

2 participants