bfarago / bfarago/bjtcputoolchain
OnDrawHexDump 4% improvement
- Dominant language
- C++
- Stars
- 5
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
**Improvement possibility.**
When hexdump shown while simulation is running, aprox 4% of the OnDrawHexDump fn execution time goes to CPen construction and desctruction. The heat map colors are comes from bus state informations and its age represented by shades, therefore RGB(variable) is provided for the CPen constructor. (Each lines may gets different color.) See attached screenshot. Here we have an effective improvement point. Even if it is only 4%, it takes a lot because of the screen refresh rate is high while the simulation is ongoing.
**Design goal:** reduce the execution time, by caching the CPen objects. And/Or limit the color resolution, to get feasible amount of CPen preinitialized in a collection. There are Execution, Write and Read lines, each of them have different shades. Different shades may shown at the same time, so multiple pen should be available for the same bus state. Human eye can not distinguish so mutch shades from one color. In example: 3X16 or 3X8 differently colored pen may fits this requirement, still reasonable amount of objects could be. One possible solution to pre initialize a 2 dimensional array of CPen objects, where dimension one is for the mode (max:3) and dimension two is the age of the busstate (max:8). Add pre draw init and deinit before the obj destr. So the lifecycle of the pen object should be longer. Cyclicly called OnDraw should only index the alive object.

**Analysis of further improvements:** The next step would be, to reduce the amount of the gdi api calls, especially DrawTextW function may be reduced, by collecting one row hexdump rather than draw numbers individually. We can sacrifice the text coloring, because it doesn't help readability anyway. Next step: address area portion can be pre-drawn, then bitblt copy may quicker.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating OnDrawHexDump and the CPen construction it performs during simulation refreshes. Read the surrounding drawing and object-lifecycle code, then measure the current rendering cost before evaluating cached or reduced-resolution pens. Done means the drawing path avoids repeated pen construction while preserving the execution, write, and read heat-map display.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop, performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100