optimize bit-to-byte boundary math to prevent empty slack byte allocation - #438
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
when working on my q3decode tool i went real deep into the quake 3 network packets and found some real confusing sing which gave me lot of headache actually until i discovered
whenever the huffman coded packet ended at byte's end which can be the case in 1/8th of all packets the packet had an extra empty byte at the end
so i tracked it down to byte boundary math in
qcommon/msg.candqcommon/huffman.cand instead of doing(x>>3)+1we better do(x+7)>>3to make nice rounding and only hop to next byte when really neededi tested against unmodified server on other side and no issues
over 25 years with 788 million seconds and 15,000 players online globally using all id tech 3 games 24/7 especially accounting for massive peaks in the 2000s with 20 packets per second from server and 60 packets from client that can be 788,000,000 x 15,000 x 80 = 946 trillion packets of which 1/8th carried a wasted byte that can be sum up to 107.5 terra bytes oh mein gott i sink john carmack clogged the internet
p. s. my coding can be better then my english off korrs :)