Reuse memory data blocks in HexWidget to eliminate redundant IO reads - #3652
Draft
andersendsa wants to merge 2 commits into
Draft
Reuse memory data blocks in HexWidget to eliminate redundant IO reads#3652andersendsa wants to merge 2 commits into
andersendsa wants to merge 2 commits into
Conversation
- Modified `MemoryData::fetch` in `src/widgets/HexWidget.h`. - Avoided redundant `Core()->ioRead` calls by reusing previously fetched QByteArray blocks. - Takes advantage of Qt's implicit sharing for O(1) performance. - Resolves the existing `// FIXME: reuse data if possible` comment.
andersendsa
marked this pull request as draft
July 28, 2026 13:32
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.
Your checklist for this pull request
Detailed description
MemoryData::fetchinsrc/widgets/HexWidget.h.Core()->ioReadcalls by reusing previously fetched QByteArray blocks.// FIXME: reuse data if possiblecomment.Test plan (required)
1. Basic Functional Verification (UI/Scrolling):
Build Cutter with this branch and open any moderately sized binary.
Navigate to the Hexdump widget.
Scroll smoothly up and down using the mouse wheel, and also use the scrollbar to jump to different sections (both small contiguous steps and large jumps).
Expected Outcome: The memory values should display correctly without any visual corruption, missing chunks, or crashes. Scrolling should feel smooth and responsive.
2. View Resizing & Cache Edge Cases:
Resize the Hexdump widget window significantly (make it much taller and wider) to trigger variable block length fetches.
Expected Outcome: The widget should correctly fetch and stitch together the new blocks along with the reused blocks without rendering artifacts.
3. Developer/Performance Verification (Optional but recommended to prove the optimization):
Temporarily add qDebug() << "ioRead called"; inside the Core()->ioRead fallback loop in MemoryData::fetch (src/widgets/HexWidget.h).
Scroll one line down in the hex view.
Expected Outcome (Master branch): You will see multiple ioRead called prints equivalent to the entire visible screen's blocks.
Expected Outcome (This PR): You will see zero or only one ioRead called print, proving the partial cache overlap is successfully reusing the existing QByteArray blocks.
Closing issues