ImHex icon indicating copy to clipboard operation
ImHex copied to clipboard

[Bug] `[[format(...)]]` is extremely slow, as opposed to `[[name(...)]]`

Open ScoreUnder opened this issue 1 year ago • 2 comments

Operating System

Linux

What's the issue you encountered?

My first attempt at writing a pattern, I used name to display array elements, but realised that format is probably the more proper option. However, format causes a noticeable drop in editor framerate and makes editing difficult, while name does not.

How can the issue be reproduced?

  1. Load the provided binary and pattern file
  2. Expand any of the arrays once
  3. Observe change in editor framerate, if any

Using the pattern with [[format()]], the framerate should drop significantly, while [[name()]] should be fine.

ImHex Version

1.27.1

ImHex Build Type

  • [X] Nightly or built from sources

Installation type

AUR

Additional context?

Built to version 1.27.1 using git tag.

pattern using [[name()]]: https://score.moe/a/imhex/defines_name.hexpat

pattern using [[format()]]: https://score.moe/a/imhex/defines_format.hexpat

test file: https://score.moe/a/imhex/defs_rse_flag.dat

ScoreUnder avatar Mar 06 '23 10:03 ScoreUnder

That is because name changes the display name, which only copies the string from the attribute to the display viewer, as opposed to format which takes in the value of the element into a function which needs to be called and also the value needs to be copied over. format is used for formatting values and if you just need to statically name array elements name should be fine

jumanji144 avatar Mar 06 '23 11:03 jumanji144

Thanks for the response. Since this is intended to provide a display format for the structs in question, is there any faster way to use the format attribute? My expectation would be that the format text would not need to be re-evaluated, since the data itself doesn't change.

On Mon, 6 Mar 2023, 11:19 Justus Garbe, @.***> wrote:

That is because name changes the display name, which only copies the string from the attribute to the display viewer, as opposed to format which takes in the value of the element into a function which needs to be called and also the value needs to be copied over. format is used for formatting values and if you just need to statically name array elements name should be fine

— Reply to this email directly, view it on GitHub https://github.com/WerWolv/ImHex/issues/965#issuecomment-1455949022, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAISKZQWDK43H7KCRA2YFPTW2XB5JANCNFSM6AAAAAAVQ6JOZM . You are receiving this because you authored the thread.Message ID: @.***>

ScoreUnder avatar Mar 06 '23 12:03 ScoreUnder

This issue is marked stale as it has been open for 11 months without activity. Please try the latest ImHex version. (Avaiable here: https://imhex.download/ for release and https://imhex.download/#nightly for development version) If the issue persists on the latest version, please make a comment on this issue again

Without response, this issue will be closed in one month.

github-actions[bot] avatar Aug 03 '24 16:08 github-actions[bot]