This repository was archived by the owner on Mar 7, 2026. It is now read-only.
Conversation
…nes were expressed that results in a massive optimisation miss and very poor codegen
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Detailed description
In this PR we address a codegen/optimisation issue that has been identified in the buffer utilities functions. These functions include the
read_{l,b}e{2,4,8}()routines which do an endian-aware read of a buffer to (re)construct an integer.The way these functions were expressed is somewhat naïve and results in extremely poor codegen (a sled of loads, shifts and adds) due to the need to deal with an offset into the buffer. It was quickly identified, however, that moving the data to a function-internal buffer with memcpy() and then doing the endian-dependant read produced the correct code output - one load, and depending on host endian, one swap.
This greatly improves the performance of these functions and their call footprint as they get inlined where they're called.
Your checklist for this pull request
Closing issues